Yoast / Yoast-SEO-for-TYPO3

Yoast SEO plugin for TYPO3
Other
51 stars 56 forks source link

PHP 8 throws exceptions due to missing array checks in SnippetPreview #542

Open Bunnyfield opened 1 year ago

Bunnyfield commented 1 year ago

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';
RinyVT commented 1 year ago

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!