JamesHeinrich / getID3

http://www.getid3.org/
Other
1.13k stars 245 forks source link

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in getid3_jpg->CastAsAppropriate() #407

Closed avdeijk closed 1 year ago

avdeijk commented 1 year ago

Describe the bug Using james-heinrich/getid3 on PHP8.1 triggers the following deprecation notice:

Deprecated function: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in getid3_jpg->CastAsAppropriate() (line 194 of [..]/vendor/james-heinrich/getid3/getid3/module.graphic.jpg.php)

This happens only for some images where the exif value for a certain keys has a value of null.

To Reproduce Use PHP8.1

Expected behavior Using PHP8.1 does not trigger a deprecation notice when the value for a certain exif key is null.

avdeijk commented 1 year ago

See pull request https://github.com/JamesHeinrich/getID3/pull/406

StudioMaX commented 1 year ago

Could you please attach any such image? I tested on my collection even on PHP 8.2, didn't seen deprecations in this part.

avdeijk commented 1 year ago

IMG_6270

Here is an image on which I got a deprecation notice.

JamesHeinrich commented 1 year ago

I tried this image and didn't see any problems on PHP 7.4.1 or 8.0.11

StudioMaX commented 1 year ago

This warning appeared since PHP 8.1. https://3v4l.org/WhV7V изображение

JamesHeinrich commented 1 year ago

I finally got a PHP 8.2 test environment set up. Once I had that it was easy to find and fix the problem(s). https://github.com/JamesHeinrich/getID3/commit/a61d9c59cf8a4224baf33f625893d3246e32c51f