-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no (it'll be when 3.3 released) |
RFC? | no |
Symfony version | 3.3 |
I just ran into the following:
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Object of class Symfony\Component\DependencyInjection\Definition could not be converted to string
Exception trace:
() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:294
Full trace
Exception trace:
() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:294
Symfony\Component\DependencyInjection\Dumper\XmlDumper->convertParameters() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:96
Symfony\Component\DependencyInjection\Dumper\XmlDumper->addMethodCalls() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:170
Symfony\Component\DependencyInjection\Dumper\XmlDumper->addService() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:255
Symfony\Component\DependencyInjection\Dumper\XmlDumper->addServices() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php:54
Symfony\Component\DependencyInjection\Dumper\XmlDumper->dump() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/ContainerBuilderDebugDumpPass.php:34
Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\ContainerBuilderDebugDumpPass->process() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/Compiler.php:120
Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php:568
Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:503
Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:116
Symfony\Component\HttpKernel\Kernel->boot() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:68
Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Volumes/HD/Sites/tests/closure-proxy-bug/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:121
Symfony\Component\Console\Application->run() at /Volumes/HD/Sites/tests/closure-proxy-bug/bin/console:28
Steps to reproduce:
- Checkout the SE in 3.3 (make sure the
symfony/symfony
vendor is in sync with the current master) - Create a not shared event listener e.g:
app.request_listener:
class: AppBundle\EventListener\RequestListener
shared: false
tags:
- { name: kernel.event_listener, event: kernel.request, method: onKernelRequest }
namespace AppBundle\EventListener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
class RequestListener
{
public function onKernelRequest(GetResponseEvent $event)
{
}
}
- Clear the cache (or anything else triggering the container to be dumped) and you face the issue
It looks like we consider that the first element of the array returned by ClosureArgument::getValues()
should always be an instance of Reference
while in this case it is a Definition
one, both XmlDumper
and PhpDumper
fail on it.
I started to dig into but it goes a bit too far, I fear to miss something thus try to fix it the wrong way. I rely on the author for this one :)
Fork of the SE with necessary changes: https://github.com/chalasr/se-bug-closureproxy
ping @nicolas-grekas