gpt4 book ai didi

Symfony:如何调试意外的 '\' (T_NS_SEPARATOR)

转载 作者:行者123 更新时间:2023-12-04 15:27:46 30 4
gpt4 key购买 nike

我在 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
{

如果我禁用这个模块,那么另一个类(class)会有这个问题......就像随机一样。

最佳答案

我发现问题是由新的 zendframework v3.0.3 引起的 - 请参阅 https://github.com/symfony/symfony/issues/9815

因此,对于目前的快速修复,只需添加

“zendframework/zend 代码”:“3.0.2”

进入你的 Composer 文件

关于Symfony:如何调试意外的 '\' (T_NS_SEPARATOR),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38077897/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com