Symfony httplug 包处理缺少 EventSubscriberInterface

use*_*145 2 php symfony symfony5

在 Symfony 5.1.8 项目中,我将 httplug 包更新到了​​ 1.19.0 版。

它在变更日志中提到:

ConfiguredClientsStrategy 不再实现 EventSubscriberInterface,这已移至 ConfiguredClientsStrategyListener 以避免在每个请求上初始化策略。

这会导致 In 中的错误

EventDispatcher.php 第 270 行

Failed to create closure from callable: class 'Http\HttplugBundle\Discovery\ConfiguredClientsStrategy' does not have a method 'onEvent'
Run Code Online (Sandbox Code Playgroud)

Ziy*_*yan 6

我在 Symfony 4.4.16 上遇到了同样的问题,我不得不手动删除旧缓存以在生产中修复它:

rm -rf var/cache/prod && bin/console cache:clear
Run Code Online (Sandbox Code Playgroud)