简体   繁体   中英

Symfony 3 - Block “title” on template “SonataPageBundle::base_error.html.twig” does not exist

I am having the error "Block "title" on template "SonataPageBundle::base_error.html.twig" does not exist. " when i am trying to access to http://localhost:8000/ . I am trying to start a project configured with sonata admin bundle and sonata page bundle, these are some of the dependencies of my project in symfony (composer.json):

PHP 7.1.8 Symfony 3.3.8

 "require": {
                "doctrine/doctrine-bundle": "^1.6",
                "doctrine/orm": "^2.5",
                "friendsofsymfony/rest-bundle": "^2.2",
                "incenteev/composer-parameter-handler": "^2.0",
                "sensio/distribution-bundle": "^5.0.19",
                "sensio/framework-extra-bundle": "^3.0.2",
                "sonata-project/admin-bundle": "^3.23",
                "sonata-project/cache-bundle": "^2.3",
                "sonata-project/datagrid-bundle": "^2.2",
                "sonata-project/doctrine-orm-admin-bundle": "^3.1",
                "sonata-project/easy-extends-bundle": "^2.2",
                "sonata-project/notification-bundle": "^3.1",
                "sonata-project/page-bundle": "^3.5",
                "sonata-project/seo-bundle": "^2.2",
                "symfony-cmf/routing-bundle": "^2.0",
                "symfony/monolog-bundle": "^3.1.0",
                "symfony/polyfill-apcu": "^1.0",
                "symfony/swiftmailer-bundle": "^2.3.10",
                "symfony/symfony": "3.3.*",
                "twig/twig": "^1.0||^2.0"
            },

and here's the error stack trace:

Twig_Error_Runtime:
Block "title" on template "SonataPageBundle::base_error.html.twig" does not exist.

  at vendor\sonata-project\page-bundle\Resources\views\base_error.html.twig:11
  at Twig_Template->displayBlock('title', array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('page_stylesheets' => array(object(__TwigTemplate_626d3c7ea09d945dea3e3ced9062d6a059ed90c3731a85afe587b65d9135355b), 'block_page_stylesheets'), 'content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')), true)
     (vendor\twig\twig\lib\Twig\Template.php:254)
  at Twig_Template->renderBlock('title', array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('page_stylesheets' => array(object(__TwigTemplate_626d3c7ea09d945dea3e3ced9062d6a059ed90c3731a85afe587b65d9135355b), 'block_page_stylesheets'), 'content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (var\cache\dev\twig\a4\a4a167564b475b5c6ead2ae566a2cfcbb882dc2de2df7ff848f92fa5b57b1a21.php:27)
  at __TwigTemplate_626d3c7ea09d945dea3e3ced9062d6a059ed90c3731a85afe587b65d9135355b->doDisplay(array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('page_stylesheets' => array(object(__TwigTemplate_626d3c7ea09d945dea3e3ced9062d6a059ed90c3731a85afe587b65d9135355b), 'block_page_stylesheets'), 'content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (vendor\twig\twig\lib\Twig\Template.php:389)
  at Twig_Template->displayWithErrorHandling(array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('page_stylesheets' => array(object(__TwigTemplate_626d3c7ea09d945dea3e3ced9062d6a059ed90c3731a85afe587b65d9135355b), 'block_page_stylesheets'), 'content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (vendor\twig\twig\lib\Twig\Template.php:366)
  at Twig_Template->display(array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (var\cache\dev\twig\89\8910d15eec17e5054a2c6abc9ebc366c887c2ca4519f4cc11e0a2a9ab49f42c3.php:30)
  at __TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a->doDisplay(array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (vendor\twig\twig\lib\Twig\Template.php:389)
  at Twig_Template->displayWithErrorHandling(array('exception' => object(InternalErrorException), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'sonata_block' => object(GlobalVariables), 'sonata_admin' => object(GlobalVariables), 'sonata_page' => object(GlobalVariables)), array('content' => array(object(__TwigTemplate_92a22adb7096a00b0799bd4759bdde6bb47abc78e12c93295c06f6a96de5ba5a), 'block_content')))
     (vendor\twig\twig\lib\Twig\Template.php:366)
  at Twig_Template->display(array('exception' => object(InternalErrorException)))
     (vendor\twig\twig\lib\Twig\Template.php:374)
  at Twig_Template->render(array('exception' => object(InternalErrorException)))
     (vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php:49)
  at Symfony\Bridge\Twig\TwigEngine->render('SonataPageBundle::internal_error.html.twig', array('exception' => object(InternalErrorException)))
     (vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php:45)
  at Symfony\Bundle\TwigBundle\TwigEngine->render('SonataPageBundle::internal_error.html.twig', array('exception' => object(InternalErrorException)))
     (vendor\sonata-project\page-bundle\Listener\ExceptionListener.php:192)
  at Sonata\PageBundle\Listener\ExceptionListener->handleInternalError(object(GetResponseForExceptionEvent))
     (vendor\sonata-project\page-bundle\Listener\ExceptionListener.php:178)
  at Sonata\PageBundle\Listener\ExceptionListener->onKernelException(object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
  at call_user_func(array(object(ExceptionListener), 'onKernelException'), object(GetResponseForExceptionEvent), 'kernel.exception', object(TraceableEventDispatcher))
     (vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\Debug\WrappedListener.php:104)
  at Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke(object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher))
  at call_user_func(object(WrappedListener), object(GetResponseForExceptionEvent), 'kernel.exception', object(ContainerAwareEventDispatcher))
     (vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\EventDispatcher.php:212)
  at Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(array(object(WrappedListener), object(WrappedListener), object(WrappedListener), object(WrappedListener)), 'kernel.exception', object(GetResponseForExceptionEvent))
     (vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\EventDispatcher.php:44)
  at Symfony\Component\EventDispatcher\EventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent))
     (vendor\symfony\symfony\src\Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher.php:146)
  at Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch('kernel.exception', object(GetResponseForExceptionEvent))
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:230)
  at Symfony\Component\HttpKernel\HttpKernel->handleException(object(InternalErrorException), object(Request), 1)
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\HttpKernel.php:79)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor\symfony\symfony\src\Symfony\Component\HttpKernel\Kernel.php:171)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web\app_dev.php:29)
  at require('C:\\...

This is an error in the template provided by SonataPageBundle (see https://github.com/sonata-project/SonataPageBundle/pull/860 ). As a workaround you can downgrade your Twig installation to 1.x:

composer update --with-dependencies twig/twig:^1.34

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM