-
Notifications
You must be signed in to change notification settings - Fork 44
Open
Description
When I upgraded to Symfony 4.0, I was met with an error:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\UndefinedMethodException: Attempted to call an undefined method named "getRootNode" of class "Symfony\Component\Config\Definition\Builder\TreeBuilder". in /var/www/html/vendor/bentools/webpush-bundle/src/DependencyInjection/Configuration.php:18
I found out that in BenTools\WebPushBundle\DependencyInjection::getConfigTreeBuilder()
if (Kernel::MAJOR_VERSION < 4) {
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('bentools_webpush');
} else {
$treeBuilder = new TreeBuilder('bentools_webpush');
$rootNode = $treeBuilder->getRootNode();
}
I noticed that other packages that are not failing are basically checking if method exists before calling it (i.e doctrine):
$treeBuilder = new TreeBuilder('doctrine');
if (method_exists($treeBuilder, 'getRootNode')) {
$rootNode = $treeBuilder->getRootNode();
} else {
// BC layer for symfony/config 4.1 and older
$rootNode = $treeBuilder->root('doctrine');
}
Notice the comment, seems thatgetRootNode method does not exist in <4.2. Could we add a support for it?
Metadata
Metadata
Assignees
Labels
No labels