Search code examples
typo3extbasetypo3-11.x

TYPO3 throws Error after Updating to 11.5.16 and PHP 8.1 (get_class_methods(): Argument #1


After Updating from TYPO3 9.5.x LTS and PHP 7.4 to TYPO3 11.5.16 and PHP 8.1 I am getting this error:

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

I know it's about my Extension (when I disable it the Error disappears), but the further debug Information I are not helping me:

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);

I couldn't find anything searching github, stackoverflow or the web. Anyone else had the same problem or knows where this could come from?


Solution

  • Right after this Post, it came to my Mind to change the PHP Version back to 7.4. With PHP 7.4 I've got a different Error Message ("Class does not exist. Reflection failed.") which leads me to: https://forge.typo3.org/issues/91239

    I made the Mistake to Register Plugin With VendorName. Just in case anyone else does it the same way, I've written this answer and would like to keep this Post.