Sonataadminbundle: Undefined index exception in list view since twig 2.6.1

Created on 14 Jan 2019  路  2Comments  路  Source: sonata-project/SonataAdminBundle

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.44.0 3.44.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.14.0 3.14.0 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  2.0.1  Cache library
sonata-project/classification-bundle     3.7.1  3.7.1  Symfony SonataClassificationBundle
sonata-project/core-bundle               3.14.0 3.14.0 Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.4.0  2.4.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.1.3  1.1.3  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.7.0  3.7.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                  1.11.0 2.0.0  Lightweight Exporter library
sonata-project/intl-bundle               2.5.0  2.5.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.17.1 3.17.1 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.5.1  3.5.1  Symfony SonataNotificationBundle
sonata-project/translation-bundle        2.4.0  2.4.0  SonataTranslationBundle
sonata-project/user-bundle               4.2.3  4.2.3  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
Restricting packages listed in "symfony/symfony" to "4.1.*"
symfony/asset                v4.1.10 v4.1.10 Symfony Asset Component
symfony/browser-kit          v4.1.10 v4.1.10 Symfony BrowserKit Component
symfony/cache                v4.1.10 v4.1.10 Symfony Cache component with PSR-6, PSR-16, and tags
symfony/config               v4.1.10 v4.1.10 Symfony Config Component
symfony/console              v4.1.10 v4.1.10 Symfony Console Component
symfony/css-selector         v4.1.10 v4.1.10 Symfony CssSelector Component
symfony/debug                v4.1.10 v4.1.10 Symfony Debug Component
symfony/debug-bundle         v4.1.10 v4.1.10 Symfony DebugBundle
symfony/debug-pack           v1.0.7  v1.0.7  A debug pack for Symfony projects
symfony/dependency-injection v4.1.10 v4.1.10 Symfony DependencyInjection Component
symfony/doctrine-bridge      v4.1.10 v4.1.10 Symfony Doctrine Bridge
symfony/dom-crawler          v4.1.10 v4.1.10 Symfony DomCrawler Component
symfony/dotenv               v4.1.10 v4.1.10 Registers environment variables from a .env file
symfony/event-dispatcher     v4.1.10 v4.1.10 Symfony EventDispatcher Component
symfony/expression-language  v4.1.10 v4.1.10 Symfony ExpressionLanguage Component
symfony/filesystem           v4.1.10 v4.1.10 Symfony Filesystem Component
symfony/finder               v4.1.10 v4.1.10 Symfony Finder Component
symfony/flex                 v1.1.8  v1.1.8  Composer plugin for Symfony
symfony/form                 v4.1.10 v4.1.10 Symfony Form Component
symfony/framework-bundle     v4.1.10 v4.1.10 Symfony FrameworkBundle
symfony/http-foundation      v4.1.10 v4.1.10 Symfony HttpFoundation Component
symfony/http-kernel          v4.1.10 v4.1.10 Symfony HttpKernel Component
symfony/inflector            v4.1.10 v4.1.10 Symfony Inflector Component
symfony/intl                 v4.1.10 v4.1.10 A PHP replacement layer for the C intl extension that includes additional data from the ICU library.
symfony/maker-bundle         v1.11.2 v1.11.2 Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/monolog-bridge       v4.1.10 v4.1.10 Symfony Monolog Bridge
symfony/monolog-bundle       v3.3.1  v3.3.1  Symfony MonologBundle
symfony/options-resolver     v4.1.10 v4.1.10 Symfony OptionsResolver Component
symfony/orm-pack             v1.0.5  v1.0.5  A pack for the Doctrine ORM
symfony/panther              v0.2.0  v0.2.0  A browser testing and web scraping library for PHP and Symfony.
symfony/phpunit-bridge       v4.2.2  v4.2.2  Symfony PHPUnit Bridge
symfony/polyfill-intl-icu    v1.10.0 v1.10.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring    v1.10.0 v1.10.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72       v1.10.0 v1.10.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/process              v4.1.10 v4.1.10 Symfony Process Component
symfony/profiler-pack        v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access      v4.1.10 v4.1.10 Symfony PropertyAccess Component
symfony/property-info        v4.1.10 v4.1.10 Symfony Property Info Component
symfony/routing              v4.1.10 v4.1.10 Symfony Routing Component
symfony/security             v4.1.10 v4.1.10 Symfony Security Component
symfony/security-acl         v3.0.1  v3.0.1  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle      v4.1.10 v4.1.10 Symfony SecurityBundle
symfony/serializer           v4.1.10 v4.1.10 Symfony Serializer Component
symfony/serializer-pack      v1.0.2  v1.0.2  A pack for the Symfony serializer
symfony/stopwatch            v4.1.10 v4.1.10 Symfony Stopwatch Component
symfony/swiftmailer-bundle   v3.2.5  v3.2.5  Symfony SwiftmailerBundle
symfony/templating           v4.1.10 v4.1.10 Symfony Templating Component
symfony/test-pack            v1.0.5  v1.0.5  A pack for functional and end-to-end testing within a Symfony app
symfony/translation          v4.1.10 v4.1.10 Symfony Translation Component
symfony/twig-bridge          v4.1.10 v4.1.10 Symfony Twig Bridge
symfony/twig-bundle          v4.1.10 v4.1.10 Symfony TwigBundle
symfony/validator            v4.1.10 v4.1.10 Symfony Validator Component
symfony/var-dumper           v4.1.10 v4.1.10 Symfony mechanism for exploring and dumping PHP variables
symfony/web-link             v4.1.10 v4.1.10 Symfony WebLink Component
symfony/web-profiler-bundle  v4.1.10 v4.1.10 Symfony WebProfilerBundle
symfony/web-server-bundle    v4.1.10 v4.1.10 Symfony WebServerBundle
symfony/yaml                 v4.1.10 v4.1.10 Symfony Yaml Component

PHP version

$ php -v
PHP 7.2.13-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Dec  7 2018 08:07:08) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.13-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.1, Copyright (c) 2002-2018, by Derick Rethans

Subject


Rendering base_list.html.twig throws an undefined index exception since update from twig 2.6.0 to 2.6.1.

Steps to reproduce

Update twig from 2.6.0 to 2.6.1

Expected results

Display admin list.

Actual results


Throws the following exceptions:

Twig_Error_Runtime:
An exception has been thrown during the rendering of a template ("Notice: Undefined index: children").

  at vendor/sonata-project/admin-bundle/src/Resources/views/CRUD/base_list.html.twig:282
  ...
ErrorException:
Notice: Undefined index: children

  at vendor/symfony/form/FormView.php:113
  at Symfony\Component\Form\FormView->offsetGet('children')
     (vendor/twig/twig/lib/Twig/Extension/Core.php:1471)
  at twig_get_attribute(object(Twig_Environment), object(Twig_Source), object(FormView), 'children', array())
     (var/cache/dev/twig/ee/ee98b05eb96ee8d16f387ffca12c4c87efbc099e2bc5a2f99d950ad010859941.php:968)
  ...
bug unconfirmed

Most helpful comment

I have the same issue and it's related to this bug : https://github.com/twigphp/Twig/issues/2810

All 2 comments

I have the same issue and it's related to this bug : https://github.com/twigphp/Twig/issues/2810

Solved with twig 2.6.2

Was this page helpful?
0 / 5 - 0 ratings