whiteoctober / Pagerfanta

Pagination for PHP.
Other
1.59k stars 2 forks source link

Error after update to version 2 #249

Open tsens opened 6 years ago

tsens commented 6 years ago

This error occurred when I upgraded to version 2

image

image

stof commented 6 years ago

can you give the stack trace of the exception (the dedicated tab in the exception page allows to get them in text format, suitable for copy/pasting) ?

tsens commented 6 years ago

Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("The option "prev_message" does not exist.").

at templates/grid_top.html.twig:45 at Twig_Template->displayWithErrorHandling(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array()) (vendor/twig/twig/lib/Twig/Template.php:367) at Twig_Template->display(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable))) (vendor/twig/twig/lib/Twig/Template.php:375) at Twig_Template->render(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable))) (vendor/twig/twig/lib/Twig/Extension/Core.php:1312) at twig_include(object(Twig_Environment), array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), 'grid_top.html.twig') (var/cache/dev/twig/f8/f882e2a32c9d4d1fb92d842358e80317f453a374183d5e48851f2c8c93cb79c8.php:51) at TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8->block_grid(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:189) at Twig_Template->displayBlock('grid', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (var/cache/dev/twig/f8/f882e2a32c9d4d1fb92d842358e80317f453a374183d5e48851f2c8c93cb79c8.php:30) at TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8->doDisplay(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(__TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:390) at Twig_Template->displayWithErrorHandling(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(__TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:367) at Twig_Template->display(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/twig/twig/lib/Twig/Template.php:375) at Twig_Template->render(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/twig/twig/lib/Twig/Environment.php:289) at Twig_Environment->render('alerts/grid.html.twig', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:225) at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('alerts/grid.html.twig', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (src/Controller/Alerts/AlertsController.php:56) at App\Controller\Alerts\AlertsController->grid(1, 0, '', '', object(AlertRepository)) (vendor/symfony/http-kernel/HttpKernel.php:149) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:66) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:190) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:37)

tsens commented 6 years ago

InvalidArgumentException: The option "prev_message" does not exist.

at vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/Template.php:61 at Pagerfanta\View\Template\Template->option('prev_message') (vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php:57) at Pagerfanta\View\Template\DefaultTemplate->previousDisabled() (vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php:154) at Pagerfanta\View\DefaultView->previous() (vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php:99) at Pagerfanta\View\DefaultView->generatePages() (vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php:85) at Pagerfanta\View\DefaultView->generate() (vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/DefaultView.php:54) at Pagerfanta\View\DefaultView->render(object(Pagerfanta), object(Closure), array('routeName' => 'alerts_paginated')) (vendor/white-october/pagerfanta-bundle/Twig/PagerfantaExtension.php:73) at WhiteOctober\PagerfantaBundle\Twig\PagerfantaExtension->renderPagerfanta(object(Pagerfanta), 'pagination_template', array('routeName' => 'alerts_paginated')) (var/cache/dev/twig/d5/d595ca5bf19bfec2f0658fe8285e0bfbe7a301c5e74de73fe303111b4fe5be06.php:127) at TwigTemplate_c577a03b277ec6122fd5714f92dfb9a574f0c1faf3fee6016c802bc8d0aac3b7->doDisplay(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array()) (vendor/twig/twig/lib/Twig/Template.php:390) at Twig_Template->displayWithErrorHandling(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array()) (vendor/twig/twig/lib/Twig/Template.php:367) at Twig_Template->display(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable))) (vendor/twig/twig/lib/Twig/Template.php:375) at Twig_Template->render(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable))) (vendor/twig/twig/lib/Twig/Extension/Core.php:1312) at twig_include(object(Twig_Environment), array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), 'grid_top.html.twig') (var/cache/dev/twig/f8/f882e2a32c9d4d1fb92d842358e80317f453a374183d5e48851f2c8c93cb79c8.php:51) at TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8->block_grid(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:189) at Twig_Template->displayBlock('grid', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (var/cache/dev/twig/f8/f882e2a32c9d4d1fb92d842358e80317f453a374183d5e48851f2c8c93cb79c8.php:30) at TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8->doDisplay(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(__TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:390) at Twig_Template->displayWithErrorHandling(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts', 'app' => object(AppVariable)), array('grid' => array(object(TwigTemplate_ab13de6fa31e1bfb832877c5ccce36a71c1903b61416894a1523cd7008ba04c8), 'block_grid'))) (vendor/twig/twig/lib/Twig/Template.php:367) at Twig_Template->display(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/twig/twig/lib/Twig/Template.php:375) at Twig_Template->render(array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/twig/twig/lib/Twig/Environment.php:289) at Twig_Environment->render('alerts/grid.html.twig', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (vendor/symfony/framework-bundle/Controller/ControllerTrait.php:225) at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('alerts/grid.html.twig', array('list' => object(Pagerfanta), 'limit' => 10, 'order' => '', 'filters' => array(), 'routeName' => 'alerts')) (src/Controller/Alerts/AlertsController.php:56) at App\Controller\Alerts\AlertsController->grid(1, 0, '', '', object(AlertRepository)) (vendor/symfony/http-kernel/HttpKernel.php:149) at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1) (vendor/symfony/http-kernel/HttpKernel.php:66) at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true) (vendor/symfony/http-kernel/Kernel.php:190) at Symfony\Component\HttpKernel\Kernel->handle(object(Request)) (public/index.php:37)

sampart commented 6 years ago

Sorry for the delay in commenting, @tsens. I'm wondering whether your versions of Pagerfanta and Pagerfanta bundle have got out-of-sync, since there were changes in both of them to use just prev_message rather than a mix of prev_message and previous_message. If only Pagerfanta has been updated and not the bundle, for example, that could explain it.

Please could you let me know what version of white-october/pagerfanta-bundle you have installed? You can see this with composer show if that helps.

Alternatively, you could just go ahead and upgrade to the latest version of PagerfantaBundle and see if that solve the problem.

tsens commented 6 years ago

white-october/pagerfanta-bundle (v1.2.0) <- ERROR

sampart commented 6 years ago

I've not managed to replicate this. It's a very odd error, because the same commit that updated this line to use prev_message:

(vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php:57)
at Pagerfanta\View\Template\DefaultTemplate->previousDisabled()

... also updated the $defaultOptions array in that same file to include a prev_message option.

Please could you attach a copy of vendor/pagerfanta/pagerfanta/src/Pagerfanta/View/Template/DefaultTemplate.php from your install so that I can take a look? Thanks

sampart commented 6 years ago

One other question - have you done a cache clear since upgrading? I've seen unusual errors like this resolved by clearing the cache in the past.

michalcampr commented 6 years ago

I had exactly the same error. After a while of searching, I found out that I was overriding the DefaultTemplate.php in my bundle and setting the $defaultOptions array, where one of the options had a key "previous_message" instead of "prev_message".

sampart commented 6 years ago

Thanks for sharing, @michalcampr. I reckon that's highly likely to be helpful to others too.