A tree builder without a root node in Symfony 4.2
Asked Answered
A

1

7

I upgraded my Symfony project from 4.1 to 4.2 and get this notice 12 times in profiler:

A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.

and the trace of the log is:

{▼
  /home/user/foo/bar/project/vendor/symfony/config/Definition/Builder/TreeBuilder.php:30 {▼
    › if (null === $name) {
    ›     @trigger_error('A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.', E_USER_DEPRECATED);
    › } else {
  }
  /home/user/foo/bar/project/vendor/sensio/framework-extra-bundle/DependencyInjection/Configuration.php:32 {▼
    › {
    ›     $treeBuilder = new TreeBuilder();
    ›     $rootNode = $treeBuilder->root('sensio_framework_extra', 'array');
  }
}

how to fix this?

Amalgamation answered 7/12, 2018 at 7:52 Comment(2)
vendor/sensio/framework-extra-bundle/DependencyInjection/Configuration.php needs to be updated in this way - github.com/symfony/symfony/pull/27476/… It is probably forgotten when this deprecation was addedStuffed
Just did an update to Symfony 4.2.1 and my 23 tree builder deprecation notices were reduced to just one: the maker-bundle. And since I don't use it I commented it out in bundles.php and viola, no more annoying depreciation notices.Midian
B
6

The issue is already be fixed in the sensio/framework-extra-bundle: https://github.com/sensiolabs/SensioFrameworkExtraBundle/issues/593

You have to wait for the next update (higher 5.2.2).

Bloodcurdling answered 7/12, 2018 at 12:35 Comment(3)
Good catch, David!Stuffed
The doctrine bundle also generates the same deprecation notice. I have not checked to see if an issue has been filed but it is another bundle that needs a slight tweak. Just one of the hazards of being an early adopter.Midian
SunCat\MobileDetectBundle alsoFiddle

© 2022 - 2024 — McMap. All rights reserved.