PHP 8.x
-
Hello,
Since running the site on PHP 8.x, we are getting recurring PHP warnings with WP YouTube Lyte:
PHP Warning: Undefined array key "title" in wp-content/plugins/wp-youtube-lyte/wp-youtube-lyte.php on line 536The warning is triggered on every page load that contains a YouTube Lyte embed.
With PHP versions prior to 8, this access was silent, but PHP 8+ now raises a warning when trying to read a non-existent array key.It appears the code accesses
$video['title']without checking if the key exists.
A simple guard would prevent the warning, for example:$title = $video['title'] ?? '';or using an
isset()check.This issue is not breaking the frontend, but it:
- clutters PHP error logs,
- can cause issues when
WP_DEBUGis enabled, - and affects PHP 8+ compatibility.
Thanks in advance for looking into this, and thank you for maintaining the plugin.
You must be logged in to reply to this topic.