Symfony 2.8-> 3.4错误PhpDumper“无法转储具有方法调用的定义。”

时间:2018-09-18 12:40:00

标签: symfony symfony-3.4 doctrine-phpcr

我正在将应用程序从Symfony 2.8更新到3.4,并收到以下错误:

Cannot dump definitions which have method calls.

以下是详细版本:

  [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

如果我在$value中引发异常之前转储PhpDumper.php:1761,我将得到:

/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.  

因此PhpDumper.php无法转储Symfony\Component\DependencyInjection\Definition吗?

我当前的解决方法是修改PhpDumper.php以免引发该异常。

感谢您的任何建议:)

更新

这可能与doctrine_phpcr有关。我创建了一个测试symfony项目,可以在其中复制它:

https://github.com/wuestkamp/my_project_name

然后我创建了一个issue

1 个答案:

答案 0 :(得分:0)

这似乎是SF 3.4.15的错误,降级为3.4.14不会导致错误。