pixelschrubber / toc

table of contents (TOC) for typo3
GNU General Public License v3.0
1 stars 3 forks source link

Upgrade to TYPO3 11.4. #4

Closed Hobokens closed 1 year ago

Hobokens commented 2 years ago

Hi, It would be wonderful if you could upgrade the extension to version 11. Hobokens

pixelschrubber commented 2 years ago

@Hobokens Did you already try to use it on Typo3 11? Any hints where it may brake?

Hobokens commented 2 years ago

@pixelschrubber - I tried to use toc with TYPO3 11.5.12 and got the following error

(1/1) TypeError

get_class_methods(): Argument #1 ($object_or_class) must be an object or a valid class name, string given
in /var/www/html/public/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);

at get_class_methods('TOC')
in /var/www/html/public/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);

at TYPO3\CMS\Extbase\Mvc\ExtbaseRequestParameters->getControllerActionName()
in /var/www/html/public/typo3/sysext/extbase/Classes/Mvc/Request.php line 193

     * @todo: Should be "public function getControllerActionName(): string", blocked by testing-framework
     */
    public function getControllerActionName()
    {
        return $this->getExtbaseAttribute()->getControllerActionName();
    }

    /**
     * Return an instance with the specified controller action name set.

at TYPO3\CMS\Extbase\Mvc\Request->getControllerActionName()
in /var/www/html/public/typo3/sysext/extbase/Classes/Core/Bootstrap.php line 272

    protected function isExtbaseRequestCacheable(RequestInterface $extbaseRequest): bool
    {
        $controllerClassName = $extbaseRequest->getControllerObjectName();
        $actionName = $extbaseRequest->getControllerActionName();
        $frameworkConfiguration = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
        $nonCacheableActions = $frameworkConfiguration['controllerConfiguration'][$controllerClassName]['nonCacheableActions'] ?? null;
        if (!is_array($nonCacheableActions)) {
            return true;

at TYPO3\CMS\Extbase\Core\Bootstrap->isExtbaseRequestCacheable(object(TYPO3\CMS\Extbase\Mvc\Request))
in /var/www/html/public/typo3/sysext/extbase/Classes/Core/Bootstrap.php line 154

    protected function handleFrontendRequest(ServerRequestInterface $request): string
    {
        $extbaseRequest = $this->extbaseRequestBuilder->build($request);
        if (!$this->isExtbaseRequestCacheable($extbaseRequest)) {
            if ($this->cObj->getUserObjectType() === ContentObjectRenderer::OBJECTTYPE_USER) {
                // ContentObjectRenderer::convertToUserIntObject() will recreate the object,
                // so we have to stop the request here before the action is actually called
                $this->cObj->convertToUserIntObject();

at TYPO3\CMS\Extbase\Core\Bootstrap->handleFrontendRequest(object(TYPO3\CMS\Core\Http\ServerRequest))
in /var/www/html/public/typo3/sysext/extbase/Classes/Core/Bootstrap.php line 148

    public function run(string $content, array $configuration, ?ServerRequestInterface $request = null): string
    {
        $request = $request ?? $GLOBALS['TYPO3_REQUEST'];
        $this->initialize($configuration);
        return $this->handleFrontendRequest($request);
    }

    protected function handleFrontendRequest(ServerRequestInterface $request): string
    {

at TYPO3\CMS\Extbase\Core\Bootstrap->run('', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Toc', 'pluginName' => 'TOC'), object(TYPO3\CMS\Core\Http\ServerRequest))
in /var/www/html/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 5388

                        // Extensions should either drop the property altogether if they don't need current instance
                        // of ContentObjectRenderer, or set the property to protected and use the setter above.
                        $classObj->cObj = $this;
                    }
                    $content = $callable($content, $conf, $this->getRequest());
                } else {
                    $this->getTimeTracker()->setTSlogMessage('Method "' . $parts[1] . '" did not exist in class "' . $parts[0] . '"', LogLevel::ERROR);
                }
            } else {

at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->callUserFunction('TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Toc', 'pluginName' => 'TOC'), '')
in /var/www/html/public/typo3/sysext/frontend/Classes/ContentObject/UserContentObject.php line 44

        if ($this->cObj->getUserObjectType() === false) {
            // Come here only if we are not called from $TSFE->processNonCacheableContentPartsAndSubstituteContentMarkers()!
            $this->cObj->setUserObjectType(ContentObjectRenderer::OBJECTTYPE_USER);
        }
        $tempContent = $this->cObj->callUserFunction($conf['userFunc'], $conf, '');
        if ($this->cObj->doConvertToUserIntObject) {
            $this->cObj->doConvertToUserIntObject = false;
            $content = $this->cObj->cObjGetSingle('USER_INT', $conf);
        } else {

at TYPO3\CMS\Frontend\ContentObject\UserContentObject->render(array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Toc', 'pluginName' => 'TOC'))
in /var/www/html/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 800

        }

        // Render content
        try {
            $content .= $contentObject->render($configuration);
        } catch (ContentRenderingException $exception) {
            // Content rendering Exceptions indicate a critical problem which should not be
            // caught e.g. when something went wrong with Exception handling itself
            throw $exception;

at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->render(object(TYPO3\CMS\Frontend\ContentObject\UserContentObject), array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Toc', 'pluginName' => 'TOC'))
in /var/www/html/public/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 736

            $timeTracker->decStackPointer();
        } else {
            $contentObject = $this->getContentObject($name);
            if ($contentObject) {
                $content .= $this->render($contentObject, $conf);
            }
        }
        if ($timeTracker->LR) {
            $timeTracker->pull($content);

at TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->cObjGetSingle('USER', array('userFunc' => 'TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run', 'extensionName' => 'Toc', 'pluginName' => 'TOC'), 'tt_content.list.20.toc_toc')
in /var/www/html/public/typo3/sysext/fluid/Classes/ViewHelpers/CObjectViewHelper.php line 197

        if ($timeTracker->LR) {
            $timeTracker->push('/f:cObject/', '<' . $typoscriptObjectPath);
        }
        $timeTracker->incStackPointer();
        $content = $contentObjectRenderer->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.'] ?? [], $typoscriptObjectPath);
        $timeTracker->decStackPointer();
        if ($timeTracker->LR) {
            $timeTracker->pull($content);
        }
pixelschrubber commented 2 years ago

Thanks! Not sure about it, and setting up typo3 11 locally is still a pain, but it might be connected with the configurePlugin within ext_localconf.php - apparently according to https://docs.typo3.org/m/typo3/book-extbasefluid/main/en-us/4-FirstExtension/7-configuring-the-plugin.html the class is being passed here?

Maybe someone wants to take over this extension and fix it? Or simply a pull request?

pixelschrubber commented 1 year ago

Thanks, @fishbone1 - merged the Pull Request and created a release, will update typo3 repo later