Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError TYPO3\CMS\Core\Page\AssetCollector::addMedia() must be of the type string, null given #199

Closed
Patta opened this issue Mar 1, 2023 · 3 comments

Comments

@Patta
Copy link
Contributor

Patta commented Mar 1, 2023

ddev, composer
PHP 7.4
TYPO3 11.5.24
tt_news feature/typo3-v11
useFluidRendering = 1

I just upgraded to TYPO3 v11 and test the feature/typo3-v11 branch. On any page with a tt_news plugin the following error occurs. With tt_news v10.1.0 it worked.

(1/1) TypeError

Argument 1 passed to TYPO3\CMS\Core\Page\AssetCollector::addMedia() must be of the type string, null given, 
called in /var/www/html/private/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php on line 74

in /var/www/html/private/typo3/sysext/core/Classes/Page/AssetCollector.php line 159

     * @param string $fileName
     * @param array $additionalInformation One dimensional hash map (array with non numerical keys) with scalar values
     * @return AssetCollector
     */
    public function addMedia(string $fileName, array $additionalInformation): self
    {
        $existingAdditionalInformation = $this->media[$fileName] ?? [];
        ArrayUtility::mergeRecursiveWithOverrule($existingAdditionalInformation, $this->ensureAllValuesAreSerializable($additionalInformation));
        $this->media[$fileName] = $existingAdditionalInformation;

at TYPO3\CMS\Core\Page\AssetCollector->addMedia(null, array('origFile' => 'REMOVED.jpg', 'origFile_mtime' => false))
in /var/www/html/private/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php line 74

        // Remove file objects for AssetCollector, as it only allows to store scalar values
        $infoOriginalFile = $info['originalFile'] ?? null;
        unset($info['originalFile'], $info['processedFile']);
        GeneralUtility::makeInstance(AssetCollector::class)->addMedia(
            $source,
            $info
        );

        $layoutKey = (string)$this->cObj->stdWrapValue('layoutKey', $conf ?? []);

at TYPO3\CMS\Frontend\ContentObject\ImageContentObject->cImage('REMOVED.jpg', array('file.' => array('maxH' => '', 'width' => '1920m'), 'imageLinkWrap' => '1', 'stdWrap.' => array('spaceAfter' => '0'), 'altText' => '', 'titleText' => '', 'file' => 'https://REMOVED.jpg'))
in /var/www/html/private/typo3/sysext/frontend/Classes/ContentObject/ImageContentObject.php line 41

        if (!empty($conf['if.']) && !$this->cObj->checkIf($conf['if.'])) {
            return '';
        }

        $theValue = $this->cImage($conf['file'] ?? '', $conf);
        if (isset($conf['stdWrap.'])) {
            $theValue = $this->cObj->stdWrap($theValue, $conf['stdWrap.']);
        }
        return $theValue;

at TYPO3\CMS\Frontend\ContentObject\ImageContentObject->render(array('file.' => array('maxH' => '', 'width' => '1920m'), 'imageLinkWrap' => '1', 'stdWrap.' => array('spaceAfter' => '0'), 'altText' => '', 'titleText' => '', 'file' => 'https://REMOVED.jpg'))
in /var/www/html/private/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 801

        }

        // 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\ImageContentObject), array('file.' => array('maxH' => '', 'width' => '1920m'), 'imageLinkWrap' => '1', 'stdWrap.' => array('spaceAfter' => '0'), 'altText' => '', 'titleText' => '', 'file' => 'https://REMOVED.jpg'))
in /var/www/html/private/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php line 737

            $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('IMAGE', array('file.' => array('maxH' => '', 'width' => '1920m'), 'imageLinkWrap' => '1', 'stdWrap.' => array('spaceAfter' => '0'), 'altText' => '', 'titleText' => '', 'file' => 'https://REMOVED.jpg'))
in /var/www/html/private/typo3conf/ext/tt_news/Classes/Plugin/TtNews.php line 2700

                        $lConf['image.']['titleText'] = $imgsTitleTexts[$cc];
                        $lConf['image.']['file'] = $imgPath . $val;

                        $theImgCode .= $this->local_cObj->cObjGetSingle('IMAGE',
                                $lConf['image.']) . $this->local_cObj->stdWrap($imgsCaptions[$cc],
                                $lConf['caption_stdWrap.']);
                    }

                    $cc++;
@Patta
Copy link
Contributor Author

Patta commented Mar 2, 2023

Can be avoided by set imageCount and catImageMode in setup to 0. This is wired, because the image markers are not used, only fluid image rendering.

@Patta
Copy link
Contributor Author

Patta commented Mar 2, 2023

If image markers are used (legacy templates), the images are missing now.

@Patta
Copy link
Contributor Author

Patta commented Mar 10, 2023

Its an core issue: https://forge.typo3.org/issues/100132

@Patta Patta closed this as completed Mar 14, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant