我在Symfony中收到以下错误消息:
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING)
当我执行DoctrineMigrations时,这一行出现了吗?
我该怎么调试呢?
这是完整的痕迹:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /Library/WebServer/Documents/hrd_3/var/cache/dev/appDevDebugProjectContainer.php:7087
Stack trace:
#0 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(117): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#1 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#2 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Library/WebServer/Documents/hrd_3/bin/console(29): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
in /Library/WebServer/Documents/hrd_3/var/cache/dev/appDevDebugProjectContainer.php on line 7087
Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting identifier (T_STRING) in /Library/WebServer/Documents/hrd_3/var/cache/dev/appDevDebugProjectContainer.php:7087
Stack trace:
#0 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(117): Symfony\Component\HttpKernel\Kernel->initializeContainer()
#1 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot()
#2 /Library/WebServer/Documents/hrd_3/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(117): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /Library/WebServer/Documents/hrd_3/bin/console(29): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
in /Library/WebServer/Documents/hrd_3/var/cache/dev/appDevDebugProjectContainer.php on line 7087
更新: 在7087的调试容器中:
class VichUploaderBundleHandlerDownloadHandler_00000000110518fa000000015e248fd4966f7bb604f68fe14d5ab23e4a657cd2 extends \\Vich\UploaderBundle\Handler\DownloadHandler implements \\ProxyManager\Proxy\VirtualProxyInterface
{
如果我禁用了这个模块,那么另一个类就会出现这个问题...就像随机一样。
答案 0 :(得分:6)
我发现问题是由新的zendframework v3.0.3引起的 - 请参阅https://github.com/symfony/symfony/issues/9815
所以对于目前的快速修复,只需添加
" zendframework / zend-code":" 3.0.2"
进入你的作曲家文件
答案 1 :(得分:0)
同样的错误出现在symfony / framework-bundle版本2.8.13,文件DependencyInjection / FrameworkExtension.php中, 第374行:
$container->setParameter('router.cache_class_prefix', $container->getParameter('kernel.container_class'));
版本2.8.12没问题:
$container->setParameter('router.cache_class_prefix', $container->getParameter('kernel.name').ucfirst($container->getParameter('kernel.environment')));
在PHP 5.6.26上测试......