georgringer / news

TYPO3 Extension news
GNU General Public License v2.0
265 stars 355 forks source link

PHP Error while rendering the RSS feed XML #2108

Closed sfroemkenjw closed 1 year ago

sfroemkenjw commented 1 year ago

Bug Report

Current Behavior PHP Error while rendering the RSS feed XML. Argument expected INT, but STRING provided in f:uri.page ViewHelper

Expected behavior/output Render the XML output without error

Environment

Possible Solution The problem seems to be here: https://github.com/georgringer/news/blob/main/Resources/Private/Templates/News/List.xml#L24 All values coming from TS can only by string or array. So 9818 from TS is a string here, but pageType is registered as INT. So either we need a string2int converter here, or the documentation has to be updated. For now we have copied the template and replaced the value with 9818 directly.

froemken commented 1 year ago

Here is the error message:

(1/1) TypeError
TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setTargetPageType(): Argument #1 ($targetPageType) must be of type int, string given, called in /var/www/html/vendor/typo3/cms-fluid/Classes/ViewHelpers/Uri/PageViewHelper.php on line 233

in /var/www/html/vendor/typo3/cms-extbase/Classes/Mvc/Web/Routing/UriBuilder.php line 405
     * Sets the page type of the target URI. Defaults to 0
     *
     * @return static the current UriBuilder to allow method chaining
     */
    public function setTargetPageType(int $targetPageType): UriBuilder
    {
        $this->targetPageType = $targetPageType;
        return $this;
    }
at TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder->setTargetPageType('9818')
in /var/www/html/vendor/typo3/cms-fluid/Classes/ViewHelpers/Uri/PageViewHelper.php line 233
        $uriBuilder = GeneralUtility::makeInstance(ExtbaseUriBuilder::class);
        $uri = $uriBuilder
            ->reset()
            ->setRequest($request)
            ->setTargetPageType($pageType)
            ->setNoCache($noCache)
            ->setSection($section)
            ->setLanguage($language)
            ->setLinkAccessRestrictedPages($linkAccessRestrictedPages)
at TYPO3\CMS\Fluid\ViewHelpers\Uri\PageViewHelper::renderWithExtbaseContext(object(TYPO3\CMS\Extbase\Mvc\Request), array('pageUid' => null, 'additionalParams' => array(), 'pageType' => '9818', 'noCache' => false, 'language' => null, 'section' => '', 'linkAccessRestrictedPages' => false, 'absolute' => true, 'addQueryString' => false, 'argumentsToBeExcludedFromQueryString' => array()))
froemken commented 1 year ago

Will be solved as TYPO3 Core bug:

https://forge.typo3.org/issues/100845