Symfony Exception

Page Not Found

Exceptions 2

Symfony\Component\HttpKernel\Exception\ NotFoundHttpException

  1.     public function onKernelException(ExceptionEvent $event): void
  2.     {
  3.         $throwable $event->getThrowable();
  4.         if ($throwable instanceof NotValidCurrentPageException) {
  5.             $event->setThrowable(new NotFoundHttpException('Page Not Found'$throwable));
  6.         }
  7.     }
  8. }
  1.         $this->called true;
  2.         $this->priority ??= $dispatcher->getListenerPriority($eventName$this->listener);
  3.         $e $this->stopwatch->start($this->name'event_listener');
  4.         ($this->optimizedListener ?? $this->listener)($event$eventName$dispatcher);
  5.         if ($e->isStarted()) {
  6.             $e->stop();
  7.         }
  1.         foreach ($listeners as $listener) {
  2.             if ($stoppable && $event->isPropagationStopped()) {
  3.                 break;
  4.             }
  5.             $listener($event$eventName$this);
  6.         }
  7.     }
  8.     /**
  9.      * Sorts the internal list of listeners for the given event by priority.
  1.         } else {
  2.             $listeners $this->getListeners($eventName);
  3.         }
  4.         if ($listeners) {
  5.             $this->callListeners($listeners$eventName$event);
  6.         }
  7.         return $event;
  8.     }
  1.         try {
  2.             $this->beforeDispatch($eventName$event);
  3.             try {
  4.                 $e $this->stopwatch->start($eventName'section');
  5.                 try {
  6.                     $this->dispatcher->dispatch($event$eventName);
  7.                 } finally {
  8.                     if ($e->isStarted()) {
  9.                         $e->stop();
  10.                     }
  11.                 }
  1.      * Handles a throwable by trying to convert it to a Response.
  2.      */
  3.     private function handleThrowable(\Throwable $eRequest $requestint $type): Response
  4.     {
  5.         $event = new ExceptionEvent($this$request$type$e);
  6.         $this->dispatcher->dispatch($eventKernelEvents::EXCEPTION);
  7.         // a listener might have replaced the exception
  8.         $e $event->getThrowable();
  9.         if (!$event->hasResponse()) {
in vendor/symfony/http-kernel/HttpKernel.php -> handleThrowable (line 89)
  1.                 $this->finishRequest($request$type);
  2.                 throw $e;
  3.             }
  4.             return $this->handleThrowable($e$request$type);
  5.         } finally {
  6.             $this->requestStack->pop();
  7.         }
  8.     }
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 29)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/www/htdocs/w0174c87/www/findevegan.de/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Pagerfanta\Exception\ OutOfRangeCurrentPageException

Page "6" does not exist. The currentPage must be inferior to "4"

  1.     {
  2.         if ($this->getNormalizeOutOfRangePages()) {
  3.             return $this->getNbPages();
  4.         }
  5.         throw new OutOfRangeCurrentPageException(sprintf('Page "%d" does not exist. The currentPage must be inferior to "%d"'$currentPage$this->getNbPages()));
  6.     }
  7.     private function resetForCurrentPageChange(): void
  8.     {
  9.         $this->currentPageResults null;
in vendor/pagerfanta/core/Pagerfanta.php -> normalizeOutOfRangeCurrentPage (line 189)
  1.      * @phpstan-return positive-int
  2.      */
  3.     private function filterOutOfRangeCurrentPage(int $currentPage): int
  4.     {
  5.         if ($this->notAllowedCurrentPageOutOfRange($currentPage)) {
  6.             return $this->normalizeOutOfRangeCurrentPage($currentPage);
  7.         }
  8.         return $currentPage;
  9.     }
in vendor/pagerfanta/core/Pagerfanta.php -> filterOutOfRangeCurrentPage (line 170)
  1.      */
  2.     private function filterCurrentPage(int $currentPage): int
  3.     {
  4.         $this->checkCurrentPage($currentPage);
  5.         return $this->filterOutOfRangeCurrentPage($currentPage);
  6.     }
  7.     /**
  8.      * @throws LessThan1CurrentPageException if the current page is less than 1
  9.      */
in vendor/pagerfanta/core/Pagerfanta.php -> filterCurrentPage (line 157)
  1.      * @throws LessThan1CurrentPageException  if the current page is less than 1
  2.      * @throws OutOfRangeCurrentPageException if It is not allowed out of range pages and they are not normalized
  3.      */
  4.     public function setCurrentPage(int $currentPage): PagerfantaInterface
  5.     {
  6.         $this->currentPage $this->filterCurrentPage($currentPage);
  7.         $this->resetForCurrentPageChange();
  8.         return $this;
  9.     }
Pagerfanta->setCurrentPage(6) in src/Repository/RecipeRepository.php (line 38)
  1.     private function getPaginator($queryBuilder$currentPage) {
  2.         $adapter = new QueryAdapter($queryBuilder);
  3.         $paginator = new Pagerfanta($adapter);
  4.         $paginator->setMaxPerPage(40);
  5.         $paginator->setCurrentPage($currentPage);
  6.         return $paginator;
  7.     }
  8.     public function findLatest($page) {
  9.         return $this->getPaginator($this->createQueryBuilder('r')->where('r.enabled = true'), $page);
RecipeRepository->getPaginator(object(QueryBuilder), '6') in src/Repository/RecipeRepository.php (line 142)
  1.             foreach ($terms as $key => $term) {
  2.                 $queryBuilder->andWhere('r.title LIKE :term' $key);
  3.                 $queryBuilder->setParameter('term' $key'%' $term'%');
  4.             }
  5.         }
  6.         return $this->getPaginator($queryBuilder$page);
  7.     }
  8.     public function findNumberOfRecipes() {
  9.         return $this->getBasicQueryBuilder()
  10.             ->select('count(r.id)')
RecipeRepository->findRecipeListForCriterias('6', null, 'smarticular', null) in src/Controller/RecipeController.php (line 159)
  1.             $response $this->handleUglyTerm($request->query->get("q"), "blogWithTerm", array("blogSlug" => $blogSlug));
  2.         }
  3.         return $response ??
  4.                 $this->render('recipe/list.html.twig', [
  5.                     'recipes' => $this->em->getRepository(Recipe::class)->findRecipeListForCriterias($request->query->get("page"1), $categorySlug$blogSlug$term),
  6.                     'term' => str_replace('+'' '$term),
  7.                     'searchPlaceholder' => "blub",
  8.                     'categories' => $this->getCategoryList('blogWithCategory', array('blogSlug' => $blog->getSlug())),
  9.                     'pageTextElements' => $this->getPageTextElements($request->query->get("page"1), $category$blog$term)
  10.         ]);
  1.         $this->dispatcher->dispatch($eventKernelEvents::CONTROLLER_ARGUMENTS);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response $controller(...$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new ViewEvent($this$request$type$response$event);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     {
  2.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3.         $this->requestStack->push($request);
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Throwable $e) {
  7.             if ($e instanceof \Error && !$this->handleAllThrowables) {
  8.                 throw $e;
  9.             }
  1.         $this->boot();
  2.         ++$this->requestStackSize;
  3.         $this->resetServices true;
  4.         try {
  5.             return $this->getHttpKernel()->handle($request$type$catch);
  6.         } finally {
  7.             --$this->requestStackSize;
  8.         }
  9.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 29)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/www/htdocs/w0174c87/www/findevegan.de/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return function (array $context) {
  5.     return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
  6. };

Logs

No log messages

Stack Traces 2

[2/2] NotFoundHttpException
Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
Page Not Found

  at vendor/babdev/pagerfanta-bundle/src/EventListener/ConvertNotValidCurrentPageToNotFoundListener.php:16
  at BabDev\PagerfantaBundle\EventListener\ConvertNotValidCurrentPageToNotFoundListener->onKernelException(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:115)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(ExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
     (vendor/symfony/event-dispatcher/EventDispatcher.php:206)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(ExceptionEvent))
     (vendor/symfony/event-dispatcher/EventDispatcher.php:56)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:127)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch(object(ExceptionEvent), 'kernel.exception')
     (vendor/symfony/http-kernel/HttpKernel.php:221)
  at Symfony\Component\HttpKernel\HttpKernel->handleThrowable(object(OutOfRangeCurrentPageException), object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:89)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:184)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/www/htdocs/w0174c87/www/findevegan.de/vendor/autoload_runtime.php')
     (public/index.php:5)                
[1/2] OutOfRangeCurrentPageException
Pagerfanta\Exception\OutOfRangeCurrentPageException:
Page "6" does not exist. The currentPage must be inferior to "4"

  at vendor/pagerfanta/core/Pagerfanta.php:216
  at Pagerfanta\Pagerfanta->normalizeOutOfRangeCurrentPage(6)
     (vendor/pagerfanta/core/Pagerfanta.php:189)
  at Pagerfanta\Pagerfanta->filterOutOfRangeCurrentPage(6)
     (vendor/pagerfanta/core/Pagerfanta.php:170)
  at Pagerfanta\Pagerfanta->filterCurrentPage(6)
     (vendor/pagerfanta/core/Pagerfanta.php:157)
  at Pagerfanta\Pagerfanta->setCurrentPage(6)
     (src/Repository/RecipeRepository.php:38)
  at App\Repository\RecipeRepository->getPaginator(object(QueryBuilder), '6')
     (src/Repository/RecipeRepository.php:142)
  at App\Repository\RecipeRepository->findRecipeListForCriterias('6', null, 'smarticular', null)
     (src/Controller/RecipeController.php:159)
  at App\Controller\RecipeController->blog(object(Request), 'smarticular', null, null)
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:74)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:184)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/www/htdocs/w0174c87/www/findevegan.de/vendor/autoload_runtime.php')
     (public/index.php:5)