dereuromark / media-embed

A PHP library to deal with all those media services around, parsing their URLs and displaying their audios/videos.
MIT License
177 stars 43 forks source link

PHP 8.2: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated #62

Closed lubos-h closed 1 year ago

lubos-h commented 1 year ago

Good day, I would like to report error on:

/src/Object/MediaObject.php: line 662 protected function _esc($text) { return htmlspecialchars($text, ENT_QUOTES, '', false); }

When passing NULL value as $text, this triggers error in PHP 8.2: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated

This happens when NULL value is passed by code on line 624 (flashvars): $flashvars = $this->_esc($flashvars)

dereuromark commented 1 year ago

Would you mind making a PR? Can you check if https://github.com/dereuromark/media-embed/tree/0.5.x fixes it? Using 0.5.x-dev branch

dereuromark commented 1 year ago

Should be resolved with https://github.com/dereuromark/media-embed/releases/tag/0.5.9

lubos-h commented 1 year ago

Hi @dereuromark , just tested, works like charm. Thank you!

dereuromark commented 1 year ago

Could you also try master maybe? A new release with types and 8.1+ is coming out soon

lubos-h commented 1 year ago

Could you also try master maybe? A new release with types and 8.1+ is coming out soon

Sorry, I should mention, yes, tried the master and all worked.