sonata-project / SonataSeoBundle

Symfony SonataSeoBundle
https://docs.sonata-project.org/projects/SonataSeoBundle
MIT License
136 stars 90 forks source link

Knp\Menu\MenuItem::setCurrent() wrong parameter type given #419

Closed DamienDeSousa closed 4 years ago

DamienDeSousa commented 4 years ago

Environment

I get this bug in my docker container.

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.75.0 3.75.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.20.0 4.3.0  Symfony SonataBlockBundle
sonata-project/cache                     1.1.1  2.0.1  Cache library
sonata-project/cache-bundle              2.4.2  3.2.1  This bundle provides caching services
sonata-project/datagrid-bundle           2.5.0  3.2.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.9.1  1.9.1  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.21.0 3.21.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.3.0  2.3.0  Lightweight Exporter library
sonata-project/form-extensions           1.6.0  1.6.0  Symfony form extensions
sonata-project/notification-bundle       3.9.0  3.9.0  Symfony SonataNotificationBundle
sonata-project/page-bundle               3.18.0 3.18.0 This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.11.0 2.11.0 Symfony SonataSeoBundle
sonata-project/twig-extensions           1.4.1  1.4.1  Sonata twig extensions

Symfony packages

$ composer show --latest 'symfony/*'
symfony/asset                      v4.4.11 v4.4.11 Symfony Asset Component
symfony/browser-kit                v4.4.11 v4.4.11 Symfony BrowserKit Component
symfony/cache                      v4.4.11 v4.4.11 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts            v2.1.3  v2.1.3  Generic abstractions related to caching
symfony/config                     v4.4.11 v4.4.11 Symfony Config Component
symfony/console                    v4.4.11 v4.4.11 Symfony Console Component
symfony/css-selector               v4.4.11 v4.4.11 Symfony CssSelector Component
symfony/debug                      v4.4.11 v4.4.11 Symfony Debug Component
symfony/debug-bundle               v4.4.11 v4.4.11 Symfony DebugBundle
symfony/dependency-injection       v4.4.11 v4.4.11 Symfony DependencyInjection Component
symfony/doctrine-bridge            v4.4.11 v4.4.11 Symfony Doctrine Bridge
symfony/dom-crawler                v4.4.11 v4.4.11 Symfony DomCrawler Component
symfony/dotenv                     v4.4.11 v4.4.11 Registers environment variables from a .env file
symfony/error-handler              v4.4.11 v4.4.11 Symfony ErrorHandler Component
symfony/event-dispatcher           v4.4.11 v4.4.11 Symfony EventDispatcher Component
symfony/event-dispatcher-contracts v1.1.9  v2.1.3  Generic abstractions related to dispatching event
symfony/expression-language        v4.4.11 v4.4.11 Symfony ExpressionLanguage Component
symfony/filesystem                 v4.4.11 v4.4.11 Symfony Filesystem Component
symfony/finder                     v4.4.11 v4.4.11 Symfony Finder Component
symfony/flex                       v1.9.2  v1.9.2  Composer plugin for Symfony
symfony/form                       v4.4.11 v4.4.11 Symfony Form Component
symfony/framework-bundle           v4.4.11 v4.4.11 Symfony FrameworkBundle
symfony/http-client                v4.4.11 v4.4.11 Symfony HttpClient component
symfony/http-client-contracts      v2.1.3  v2.1.3  Generic abstractions related to HTTP clients
symfony/http-foundation            v4.4.11 v4.4.11 Symfony HttpFoundation Component
symfony/http-kernel                v4.4.11 v4.4.11 Symfony HttpKernel Component
symfony/inflector                  v4.4.11 v4.4.11 Symfony Inflector Component
symfony/intl                       v4.4.11 v4.4.11 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/mailer                     v4.4.11 v4.4.11 Symfony Mailer Component
symfony/maker-bundle               v1.21.0 v1.21.0 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/mime                       v4.4.11 v4.4.11 A library to manipulate MIME messages
symfony/monolog-bridge             v4.4.11 v4.4.11 Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.4.11 v4.4.11 Symfony OptionsResolver Component
symfony/phpunit-bridge             v5.1.3  v5.1.3  Symfony PHPUnit Bridge
symfony/polyfill-intl-grapheme     v1.18.1 v1.18.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu          v1.18.1 v1.18.1 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.18.1 v1.18.1 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.18.1 v1.18.1 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.18.1 v1.18.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.18.1 v1.18.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/process                    v4.4.11 v4.4.11 Symfony Process Component
symfony/property-access            v4.4.11 v4.4.11 Symfony PropertyAccess Component
symfony/property-info              v4.4.11 v4.4.11 Symfony Property Info Component
symfony/routing                    v4.4.11 v4.4.11 Symfony Routing Component
symfony/security-acl               v3.1.0  v3.1.0  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.4.11 v4.4.11 Symfony SecurityBundle
symfony/security-core              v4.4.11 v4.4.11 Symfony Security Component - Core Library
symfony/security-csrf              v4.4.11 v4.4.11 Symfony Security Component - CSRF Library
symfony/security-guard             v4.4.11 v4.4.11 Symfony Security Component - Guard
symfony/security-http              v4.4.11 v4.4.11 Symfony Security Component - HTTP Integration
symfony/serializer                 v4.4.11 v4.4.11 Symfony Serializer Component
symfony/service-contracts          v2.1.3  v2.1.3  Generic abstractions related to writing services
symfony/stopwatch                  v4.4.11 v4.4.11 Symfony Stopwatch Component
symfony/string                     v5.1.3  v5.1.3  Symfony String component
symfony/templating                 v4.4.11 v4.4.11 Symfony Templating Component
symfony/translation                v4.4.11 v4.4.11 Symfony Translation Component
symfony/translation-contracts      v2.1.3  v2.1.3  Generic abstractions related to translation
symfony/twig-bridge                v4.4.11 v4.4.11 Symfony Twig Bridge
symfony/twig-bundle                v4.4.11 v4.4.11 Symfony TwigBundle
symfony/validator                  v4.4.11 v4.4.11 Symfony Validator Component
symfony/var-dumper                 v4.4.11 v4.4.11 Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v4.4.11 v4.4.11 A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-link                   v4.4.11 v4.4.11 Symfony WebLink Component
symfony/web-profiler-bundle        v4.4.11 v4.4.11 Symfony WebProfilerBundle
symfony/yaml                       v4.4.11 v4.4.11 Symfony Yaml Component

Knp packages

knplabs/knp-menu        v3.1.2 v3.1.2 An object oriented menu library
knplabs/knp-menu-bundle v3.0.0 v3.0.0 This bundle provides an integration of the KnpMenu library

PHP version

$ php -v
PHP 7.3.20 (cli) (built: Jul 22 2020 10:03:35) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.20, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.20, Copyright (c) 1999-2018, by Zend Technologies

Subject

I am following the Page Bundle chapter 4 - Getting Started.
When I go on the root page, I get an error on the Knp\Menu\MenuItem::setCurrent().

Steps to reproduce

Install the SonataPageBundle, then follow all steps up to chapter 4 - Getting started. I ran the following commands :

  1. bin/console sonata:page:create-site --enabled=true --name=localhost --locale=- --host=localhost --relativePath=/ --enabledFrom=now --enabledTo="+10 years" --default=true
  2. php bin/console sonata:page:update-core-routes --site=all
  3. php bin/console sonata:page:create-snapshots --site=all All these commands return a OK result like in the tutorial. Then go on the url http://base_url/ to see the error.

Expected results

The expected result is the following (I suppose): knp-param-type-error-expected

Actual results

I have the following result: knp-param-type-error

This is the stack trace:

TypeError:
Argument 1 passed to Knp\Menu\MenuItem::setCurrent() must be of the type bool or null, string given, called in /var/www/vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php on line 124

  at vendor/knplabs/knp-menu/src/Knp/Menu/MenuItem.php:489
  at Knp\Menu\MenuItem->setCurrent('/')
     (vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php:124)
  at Sonata\SeoBundle\Block\Breadcrumb\BaseBreadcrumbMenuBlockService->getRootMenu(object(BlockContext))
     (vendor/sonata-project/page-bundle/src/Block/BreadcrumbBlockService.php:65)
  at Sonata\PageBundle\Block\BreadcrumbBlockService->getMenu(object(BlockContext))
     (vendor/sonata-project/block-bundle/src/Block/Service/MenuBlockService.php:94)
  at Sonata\BlockBundle\Block\Service\MenuBlockService->execute(object(BlockContext), object(Response))
     (vendor/sonata-project/block-bundle/src/Block/BlockRenderer.php:85)
  at Sonata\BlockBundle\Block\BlockRenderer->render(object(BlockContext))
     (vendor/sonata-project/block-bundle/src/Templating/Helper/BlockHelper.php:284)
  at Sonata\BlockBundle\Templating\Helper\BlockHelper->render(object(Block))
     (vendor/sonata-project/block-bundle/src/Templating/Helper/BlockHelper.php:211)
  at Sonata\BlockBundle\Templating\Helper\BlockHelper->renderEvent('breadcrumb', array('context' => 'page', 'current_uri' => '/'))
     (var/cache/dev/twig/87/87681cb0e4596ef5ae81c06f6623e2b4d53754e23bf39c3fcb65d2de40152457.php:170)
  at __TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f->block_sonata_page_breadcrumb(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:182)
  at Twig\Template->displayBlock('sonata_page_breadcrumb', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (var/cache/dev/twig/87/87681cb0e4596ef5ae81c06f6623e2b4d53754e23bf39c3fcb65d2de40152457.php:81)
  at __TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f->block_sonata_page_container(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:182)
  at Twig\Template->displayBlock('sonata_page_container', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (var/cache/dev/twig/f2/f21da1c30c177b147a75e78b42acc051e31776390decd8bc47380a234bfe6fc1.php:74)
  at __TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d->doDisplay(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_html_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_stylesheets'), 'page_stylesheets' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_javascripts'), 'page_javascripts' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_top_bar'), 'page_top_bar' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'page_container' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_sonata_page_asset_footer'), 'page_asset_footer' => array(object(__TwigTemplate_32e6a07454166124af0b36d5a26d170b8dc09b5e9b67287bad3c26dd25283c2d), 'block_page_asset_footer'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (var/cache/dev/twig/87/87681cb0e4596ef5ae81c06f6623e2b4d53754e23bf39c3fcb65d2de40152457.php:50)
  at __TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f->doDisplay(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('sonata_page_container' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_container'), 'sonata_page_breadcrumb' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_sonata_page_breadcrumb'), 'page_content' => array(object(__TwigTemplate_7c8c4c5f8fb01ffb0830e597a631aba9c54ca610ff6c61b5c33160abd6d7173f), 'block_page_content')))
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (vendor/twig/twig/src/Template.php:390)
  at Twig\Template->render(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (vendor/symfony/twig-bridge/TwigEngine.php:54)
  at Symfony\Bridge\Twig\TwigEngine->render('@SonataPage/layout.html.twig', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (vendor/symfony/twig-bundle/TwigEngine.php:53)
  at Symfony\Bundle\TwigBundle\TwigEngine->renderResponse('@SonataPage/layout.html.twig', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (vendor/sonata-project/page-bundle/src/Page/TemplateManager.php:107)
  at Sonata\PageBundle\Page\TemplateManager->renderResponse('default', array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (vendor/sonata-project/page-bundle/src/Page/Service/DefaultPageService.php:57)
  at Sonata\PageBundle\Page\Service\DefaultPageService->execute(object(SnapshotPageProxy), object(Request), array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (vendor/sonata-project/page-bundle/src/Page/PageServiceManager.php:100)
  at Sonata\PageBundle\Page\PageServiceManager->execute(object(SnapshotPageProxy), object(Request), array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (vendor/symfony/http-kernel/HttpKernel.php:158)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/http-kernel/HttpKernel.php:80)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/http-kernel/Kernel.php:201)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (public/index.php:25)

I looked in the vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php file and I edit the following lines (line 123 to 125):

        if (method_exists($menu, 'setCurrent')) {
            $menu->setCurrent($settings['current_uri']);
        }

to these new lines:

        if (method_exists($menu, 'setCurrent') && method_exists($menu, 'setUri')) {
            $menu->setCurrent(true);
            $menu->setUri($settings['current_uri']);
        }

And it fix the problem.

Before submitting the issue, I check on the already present issues and I don't find something similar. If an issue already exists, I am very sorry, I didn't seen this one :/

Don't hesistate to tell me if my fix really fix the problem or not :D

I'm not sure if it's a real bug or just a wrong dependency on my project. If you need more informations ask me :D

DamienDeSousa commented 4 years ago

Hi, I already created an issue but in the wrong project. You can find it here

greg0ire commented 4 years ago

I looked in the vendor/sonata-project/seo-bundle/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php file and I edit the following lines (line 123 to 125):

You can use permalinks for this, like so: https://github.com/sonata-project/SonataSeoBundle/blob/2c9c4629b4ed66bdbee6d813c1d5eef95e14e193/src/Block/Breadcrumb/BaseBreadcrumbMenuBlockService.php#L119-L125

Looking at the history of knp/menu, both setCurrent and setUri seem very old, not sure why/if we need these method_exists calls.

greg0ire commented 4 years ago

I think they were needed for support of knp/menu 1 https://github.com/sonata-project/SonataSeoBundle/commit/b0ae33a121ab8beb2a517224b778d46fd50faca8

That version does not support php 7, which we require, so we can just drop both checks

greg0ire commented 4 years ago

@DamienDeSousa consider sending a PR with your fix, but without the if

DamienDeSousa commented 4 years ago

I close this issue and link here the Pull Request.