TYPO3 更新到 11.5.16 和 PHP 8.1 后抛出错误 (get_class_methods(): Argument #1

luf*_*ufi 4 typo3 extbase typo3-11.x

从 TYPO3 9.5.x LTS 和 PHP 7.4 更新到 TYPO3 11.5.16 和 PHP 8.1 后,我收到此错误:

get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
Run Code Online (Sandbox Code Playgroud)

我知道这是关于我的扩展(当我禁用它时错误消失),但进一步的调试信息我没有帮助我:

in /html/typo3/typo3_src-11.5.16/typo3/sysext/extbase/Classes/Mvc/ExtbaseRequestParameters.php line 302

            // todo: this is nonsense! We can detect a non existing method in
            // todo: \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin, if necessary.
            // todo: At this point, we want to have a getter for a fixed value.
            $actionMethodName = $this->controllerActionName . 'Action';
            $classMethods = get_class_methods($controllerObjectName);
            if (is_array($classMethods)) {
                foreach ($classMethods as $existingMethodName) {
                    if (strtolower($existingMethodName) === strtolower($actionMethodName)) {
                        $this->controllerActionName = substr($existingMethodName, 0, -6);
Run Code Online (Sandbox Code Playgroud)

我在 github、stackoverflow 或网络上找不到任何内容。其他人有同样的问题或知道这可能来自哪里?

luf*_*ufi 6

就在这篇文章之后,我想到将 PHP 版本改回 7.4。使用 PHP 7.4,我收到了不同的错误消息(“类不存在。反射失败。”),这导致我: https: //forge.typo3.org/issues/91239

我错误地使用 VendorName 注册插件。以防万一其他人也这样做,我写了这个答案并想保留这篇文章。

  • 弃用:#88995 - 使用供应商名称调用 registerPlugin:https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/10.1/Deprecation-88995-CallingRegisterPluginWithVendorName.html (5认同)