Cannot dump definitions which have method calls.
Hi Fab, and all,
I want to help, but please note that this is a very elusive issue. I do not have a minimal repro test case, but I will try to elaborate:
Error message : "Cannot dump definitions which have method calls.".
Stacktrace: PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Cannot dump definitions which have method calls.' in /var/www/test_deployment/shared/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:1018\nStack trace:\n#0 /var/www/test_deployment/shared/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php(337): Symfony\Component\DependencyInjection\Dumper\PhpDumper->dumpValue(Object(Symfony\Component\DependencyInjection\Definition))\n#1 /var/www/test_deployment/shared/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php(572): Symfony\Component\DependencyInjection\Dumper\PhpDumper->addServiceInstance('serializer', Object(Symfony\Component\DependencyInjection\Definition))\n#2 /var/www/test_deployment/shared/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php(631): Symfony\Component\DependencyInjection\Dumper\PhpDumper->addService('serializer', Object(Symfony\Component\DependencyInjection\Definition))\n#3 /var/www/test_deploym in /var/www/test_deployment/shared/vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php on line 1018
Faulting service (via php app/console container:debug), this is the value I got from dumping the "$class" in addServiceInstance . sensio_framework_extra.converter.manager container Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager
Repro steps: NONE
However, I narrowed down the commit to a CONFLICT MERGE which requires manual intervention. From git diff, there are 4 major places which were affected:
- a constants file, containing things like class Status { const ACTIVE = 0; } which is not breaking
- test cases in phpunit, nothing fancy.
- services.xml, adding 4 new custom services
Apparently, the 3) is the most likely cause because the stacktrace also tells of something in adding a service instance. However, those were all custom developed instances and with prefixed ids, so would never conflict with the other bundle ones. Yet, the commit before this faulty commit works. No more idea on how to work.
A very suspicious bundle is the Sensio bundle, and the class is Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterManager .
Temporary fix: Comment out the 'Cannot dump definitions which have method calls.'. I don't like it, but I have to.
Environment and code revisions:
$php -v PHP 5.4.0 (cli) (built: Mar 23 2012 15:08:43) Copyright (c) 1997-2012 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
$ apachectl -v Server version: Apache/2.2.22 (Unix) Server built: Mar 26 2012 17:54:48
"git log" at /vendor/symfony/src/Symfony/Component/DependencyInjection/Dumper gives: commit b55a43813e8fbcf4facd19ce1da0cd7acc67ce9b Author: Fabien Potencier [email protected] Date: Wed Nov 16 20:35:49 2011 +0100
"git log" at /vendor/bundles/Sensio/Bundle/FrameworkExtraBundle/Request/ParamConverter commit dcd40eb4e2fff2d82fad644bb44fc2a40ccaf381 Merge: 96949b8 338cc31 Author: Fabien Potencier [email protected] Date: Mon Nov 7 08:38:47 2011 +0100
The code change/commit is private resource, such as I cannot divulge information publicly to be indexed. Developers of the branch may want to ping me. Thanks.
I just want to add that, I've read over : https://github.com/doctrine/DoctrineBundle/issues/45#issuecomment-6391198 https://github.com/symfony/symfony/issues/4016
but to no avail. I also never made changes to profiler in the faulty commit, and this issue happens in both dev and prod environment.
Sorry I think I should be filing it in Symfony instead. Thanks.