PHP7带接口的类型错误

问题描述 投票:0回答:2

在我的symfony项目中,我收到了供应商的错误。

致命错误:未捕获的Symfony \ Component \ Debug \ Exception \ FatalThrowableError:类型错误:参数1传递给eZ \ Publish \ Core \ MVC \ Legacy \ Kernel \ Loader :: setCLIHandler()必须实现接口ezpKernelHandler,eZ \ Publish \的实例给出了Core \ MVC \ Legacy \ Kernel \ CLIHandler,在/ Users / steve /第237行的/Users/steve/Projects/Web/BuildSuccess/www/vendor/ezsystems/legacy-bridge/mvc/Kernel/Loader.php中调用项目/网络/ BuildSuccess / WWW /供应商/ ezsystems /遗留桥/ MVC /核心/ Loader.php:255

但是这个错误很奇怪因为我检查了并且eZ \ Publish \ Core \ MVC \ Legacy \ Kernel \ CLIHandler实现了接口ezpKernelHandler!

namespace eZ\Publish\Core\MVC\Legacy\Kernel;

use ezpKernelHandler;

class CLIHandler implements ezpKernelHandler
{
   ...
}

我尝试用get_class方法进行调试,然后得到

"eZ\Publish\Core\MVC\Legacy\Kernel\CLIHandler"

我也使用了class_implements方法

array(0) {
}

有什么想法追加?

谢谢

php symfony
2个回答
1
投票

我看到它不是你的代码,而是eZ Publish本身。因此,您不太可能更新源代码,但仍有一些事情可以做:

  1. 检查Composer自动加载器配置,以查看ezpKernelHandler类是否已正确解析。您可能需要为其注册自定义自动加载器。
  2. 您最有可能收到此错误,因为您使用的是Symfony 3.3+及其最近添加的services auto-configuration功能。您可以通过禁用受影响服务的服务自动配置来避免抛出此错误,请查看示例here
  3. 由于此错误是致命的但可捕获 - 如果没有其他任何帮助,您可以为此特定服务创建自己的服务工厂并捕获其中的错误。

0
投票

修正:https://github.com/ezsystems/LegacyBridge/issues/132

通过创建app / autoload.php文件可以轻松修复,该文件需要vendor / autoload.php和ezpublish_legacy / autoload.php并更改bin / console以要求该文件而不是vendor / autoload.php

© www.soinside.com 2019 - 2024. All rights reserved.