Symfony 2.8 -> 3.4 ERROR PhpDumper "Cannot dump definitions which have method calls."

616 views Asked by At

I'm updating an application from Symfony 2.8 to 3.4 and getting the following error:

Cannot dump definitions which have method calls.

Here the verbose version:

  [Symfony\Component\DependencyInjection\Exception\RuntimeException]  
  Cannot dump definitions which have method calls.                    


Exception trace:
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->dumpValue() at /project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:642
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->addServiceMethodCalls() at /project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:521
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->addServiceInlinedDefinitions() at /project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:834
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->addService() at /project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:876
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->addServices() at /project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:193
 Symfony\Component\DependencyInjection\Dumper\PhpDumper->dump() at /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:859
 Symfony\Component\HttpKernel\Kernel->dumpContainer() at /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:663
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:135
 Symfony\Component\HttpKernel\Kernel->boot() at /project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php:148
 Symfony\Component\Console\Application->run() at /project/bin/console:27

If I dump $value before the exception is thrown in PhpDumper.php:1761 I'm getting:

/project/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php:1761:
class Symfony\Component\DependencyInjection\Definition#278 (24) {
  private $class =>
  string(32) "Doctrine\Common\Cache\ArrayCache"
  private $file =>
  NULL
  private $factory =>
  NULL
  private $shared =>
  bool(true)
  private $deprecated =>
  bool(false)
  private $deprecationTemplate =>
  NULL
  private $properties =>
  array(0) {
  }
  private $calls =>
  array(1) {
    [0] =>
    array(2) {
      [0] =>
      string(12) "setNamespace"
      [1] =>
      array(1) {
        ...
      }
    }
  }
  private $instanceof =>
  array(0) {
  }
  private $autoconfigured =>
  bool(false)
  private $configurator =>
  NULL
  private $tags =>
  array(0) {
  }
  private $public =>
  bool(false)
  private $private =>
  bool(false)
  private $synthetic =>
  bool(false)
  private $abstract =>
  bool(false)
  private $lazy =>
  bool(false)
  private $decoratedService =>
  NULL
  private $autowired =>
  bool(false)
  private $autowiringTypes =>
  array(0) {
  }
  private $changes =>
  array(2) {
    'class' =>
    bool(true)
    'public' =>
    bool(true)
  }
  private $bindings =>
  array(0) {
  }
  private $errors =>
  array(0) {
  }
  protected $arguments =>
  array(0) {
  }
}

In PhpDumper.php line 1762:

  Cannot dump definitions which have method calls.  

So the PhpDumper.php cannot dump Symfony\Component\DependencyInjection\Definition?

My current workaround is to modify PhpDumper.php to not throw that exception.

Thankful for any suggestions :)

UPDATE

this could be related to doctrine_phpcr. I created a test symfony project where this can be reproduced:

https://github.com/wuestkamp/my_project_name

And I created an issue.

Kim

1

There are 1 answers

0
Kim On

This seems to be a bug with SF 3.4.15, downgrading to 3.4.14 results in no error.