Yoast-SEO-for-TYPO3 icon indicating copy to clipboard operation
Yoast-SEO-for-TYPO3 copied to clipboard

PHP 8 throws exceptions due to missing array checks in SnippetPreview

Open Bunnyfield opened this issue 1 year ago • 1 comments

https://github.com/Yoast/Yoast-SEO-for-TYPO3/blob/9cb948047d706f6174b6ed49def8275d299f8f33/Classes/Form/Element/SnippetPreview.php#L99

The lines should probably look like this instead:

    $this->titleField = $this->data['parameterArray']['fieldConf']['config']['settings']['titleField'] ?? 'title';

    $this->pageTitleField = $this->data['parameterArray']['fieldConf']['config']['settings']['pageTitleField'] ?? 'title';

    $this->descriptionField = $this->data['parameterArray']['fieldConf']['config']['settings']['descriptionField'] ?? 'description';

Bunnyfield avatar Jul 06 '23 19:07 Bunnyfield

Hi @Bunnyfield,

Seems like a logical thing to change, but I'm wondering where or in what situation you encounter these errors? When the snippet preview is rendered within the page properties the array should always be available, does this error occur within pages or within another configured record where the TCA configuration is missing perhaps? I cannot reproduce this error, not even with E_ALL error reporting.

Nonetheless, will make a change for it!

RinyVT avatar Jul 27 '23 13:07 RinyVT