julmud / phpDVDProfiler

Adoption of the defunct phpDVDProfiler
MIT License
1 stars 4 forks source link

Missing rating image causes profile display to throw a fatal error #28

Closed sebk-666 closed 4 years ago

sebk-666 commented 4 years ago

Hi,

I recently added a disc profile to DVDProfiler with an "Unrated" disc (American Psycho 4K UHD, US, 031398-291886). When trying to lookup the rating image, phpdvdprofiler throws an error and does not load the profile page:

PHP Fatal error:  Uncaught Error: Call to undefined function mb_ereg_replace() in /var/www/html/phpdvdprofiler/functions.php:1041\nStack trace:\n#0 /var/www/html/phpdvdprofiler/index.php(2893): GetRatingLogo('0', 'Film', 'Unrated')\n#1 {main}\n  thrown in /var/www/html/phpdvdprofiler/functions.php on line 1041

Looking at the gfx/Ratings folder, I see that the rating_0_film_unrated.gif image does not exist. I copied the "_nr.gif" image to "rating_0_film_unrated.gif" which fixed the error, but apparently NR and Unrated is not the same as both are valid options in DVDProfiler. So a valid rating_0_film_unrated.gif image seems to be required.

Sebastian

sebk-666 commented 4 years ago

Same issue exists for rating_8_film_12.gif (French 12 movie rating).

sebk-666 commented 4 years ago

Upon further investigation I became aware that the missing file is not the root cause. If the file exists, the code portion that uses mb_ereg_replace() is never executed. However, if the file is missing and we call mb_ereg_replace() an error is thrown.

I originally assumed that mb_ereg_replace() was built-in to PHP and that the error message was kind of misleading - turns out, the error message is actually correct and that function was indeed not defined, because the php-mbstring package was not installed on my system. Installing the package fixed the error. In case the rating logo is missing, a string representation is now displayed instead.

I'm closing this issue...