Symfony Exception

Page Not Found

Exceptions 2

Symfony\Component\HttpKernel\Exception\ NotFoundHttpException

  1.             // Support for Symfony 4.3 and before
  2.             $throwable $event->getException();
  3.         }
  4.         if ($throwable instanceof NotValidCurrentPageException) {
  5.             $notFoundHttpException = new NotFoundHttpException('Page Not Found'$throwable);
  6.             if (method_exists($event'setThrowable')) {
  7.                 $event->setThrowable($notFoundHttpException);
  8.             } else {
  9.                 // Support for Symfony 4.3 and before
  10.                 $event->setException($notFoundHttpException);
  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.     {
  2.         foreach ($listeners as $listener) {
  3.             if ($event->isPropagationStopped()) {
  4.                 break;
  5.             }
  6.             $listener($event$eventName$this);
  7.         }
  8.     }
  9.     /**
  10.      * Sorts the internal list of listeners for the given event by priority.
  1.      * @param object     $event     The event object to pass to the event handlers/listeners
  2.      */
  3.     protected function callListeners(iterable $listenersstring $eventName$event)
  4.     {
  5.         if ($event instanceof Event) {
  6.             $this->doDispatch($listeners$eventName$event);
  7.             return;
  8.         }
  9.         $stoppable $event instanceof ContractsEvent || $event instanceof StoppableEventInterface;
  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.      * @throws \Exception
  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 91)
  1.                 $this->finishRequest($request$type);
  2.                 throw $e;
  3.             }
  4.             return $this->handleThrowable($e$request$type);
  5.         }
  6.     }
  7.     /**
  8.      * {@inheritdoc}
  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.     }
Kernel->handle() in public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Pagerfanta\Exception\ OutOfRangeCurrentPageException

Page "2" does not exist. The currentPage must be inferior to "1"

  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/pagerfanta/lib/Core/Pagerfanta.php -> normalizeOutOfRangeCurrentPage (line 275)
  1.      * @param int $currentPage
  2.      */
  3.     private function filterOutOfRangeCurrentPage($currentPage): int
  4.     {
  5.         if ($this->notAllowedCurrentPageOutOfRange($currentPage)) {
  6.             return $this->normalizeOutOfRangeCurrentPage($currentPage);
  7.         }
  8.         return $currentPage;
  9.     }
in vendor/pagerfanta/pagerfanta/lib/Core/Pagerfanta.php -> filterOutOfRangeCurrentPage (line 247)
  1.      */
  2.     private function filterCurrentPage($currentPage): int
  3.     {
  4.         $currentPage $this->toInteger($currentPage);
  5.         $this->checkCurrentPage($currentPage);
  6.         $currentPage $this->filterOutOfRangeCurrentPage($currentPage);
  7.         return $currentPage;
  8.     }
  9.     /**
  1.     {
  2.         if (\count(\func_get_args()) > 1) {
  3.             $this->useDeprecatedCurrentPageBooleanArguments(\func_get_args());
  4.         }
  5.         $this->currentPage $this->filterCurrentPage($currentPage);
  6.         $this->resetForCurrentPageChange();
  7.         return $this;
  8.     }
Pagerfanta->setCurrentPage() in src/Repository/PaperRepository.php (line 400)
  1.      */
  2.     private function createPaginator(Query $queryint $page): Pagerfanta
  3.     {
  4.         $paginator = new Pagerfanta(new DoctrineORMAdapter($query));
  5.         $paginator->setMaxPerPage(Papers::NUM_ITEMS);
  6.         $paginator->setCurrentPage($page);
  7.         return $paginator;
  8.     }
  9. }
PaperRepository->createPaginator() in src/Repository/PaperRepository.php (line 250)
  1.             ->setParameter("author""%".$author."%");
  2.         $qb->addOrderBy("paper.id""DESC");
  3.         $query $qb->getQuery();
  4.         return $this->createPaginator($query$page);
  5.     }
  6.     /**
  7.      * @param $userIds
  8.      * @return array
PaperRepository->getAuthorPapers() in src/Controller/PapersController.php (line 322)
  1.     public function author($authorRequest $request)
  2.     {
  3.         $page $request->query->get("page"1);
  4.         $papers $this->getDoctrine()
  5.             ->getRepository(Papers::class)
  6.                 ->getAuthorPapers($page$author);
  7.         return $this->render('paper/authors.html.twig', [
  8.             'papers' => $papers,
  9.             'author' => $author,
  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);
  9.             $this->dispatcher->dispatch($eventKernelEvents::VIEW);
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  4.         try {
  5.             return $this->handleRaw($request$type);
  6.         } catch (\Exception $e) {
  7.             if ($e instanceof RequestExceptionInterface) {
  8.                 $e = new BadRequestHttpException($e->getMessage(), $e);
  9.             }
  10.             if (false === $catch) {
  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.     }
Kernel->handle() in public/index.php (line 25)
  1.     Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request Request::createFromGlobals();
  5. $response $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request$response);

Logs

No log messages

Stack Traces 2

[2/2] NotFoundHttpException

Symfony\Component\HttpKernel\Exception\NotFoundHttpException:
Page Not Found

  at vendor/white-october/pagerfanta-bundle/EventListener/ConvertNotValidCurrentPageToNotFoundListener.php:25
  at WhiteOctober\PagerfantaBundle\EventListener\ConvertNotValidCurrentPageToNotFoundListener->onException()
     (vendor/symfony/event-dispatcher/Debug/WrappedListener.php:126)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:264)
  at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:239)
  at Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
     (vendor/symfony/event-dispatcher/EventDispatcher.php:73)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
     (vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:168)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch()
     (vendor/symfony/http-kernel/HttpKernel.php:219)
  at Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
     (vendor/symfony/http-kernel/HttpKernel.php:91)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)                

[1/2] OutOfRangeCurrentPageException

Pagerfanta\Exception\OutOfRangeCurrentPageException:
Page "2" does not exist. The currentPage must be inferior to "1"

  at vendor/pagerfanta/pagerfanta/lib/Core/Pagerfanta.php:302
  at Pagerfanta\Pagerfanta->normalizeOutOfRangeCurrentPage()
     (vendor/pagerfanta/pagerfanta/lib/Core/Pagerfanta.php:275)
  at Pagerfanta\Pagerfanta->filterOutOfRangeCurrentPage()
     (vendor/pagerfanta/pagerfanta/lib/Core/Pagerfanta.php:247)
  at Pagerfanta\Pagerfanta->filterCurrentPage()
     (vendor/pagerfanta/pagerfanta/lib/Core/Pagerfanta.php:201)
  at Pagerfanta\Pagerfanta->setCurrentPage()
     (src/Repository/PaperRepository.php:400)
  at App\Repository\PaperRepository->createPaginator()
     (src/Repository/PaperRepository.php:250)
  at App\Repository\PaperRepository->getAuthorPapers()
     (src/Controller/PapersController.php:322)
  at App\Controller\PapersController->author()
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)