Jemt / SitemagicCMS

Sitemagic CMS - world's most beautiful Content Management System
http://sitemagic.org
Other
16 stars 12 forks source link

PHP 8.2: utf8_decode(..) emit tons of deprecated warnings to the log = serious performance impact #153

Open Jemt opened 2 months ago

Jemt commented 2 months ago

A huge amount of deprecation warnings are logged on PHP 8.2:

Error 8192: Function utf8_decode() is deprecated

Sure enough, utf8_decode(..) was deprecated with PHP 8.2: https://www.php.net/manual/en/function.utf8-decode.php

This function has been DEPRECATED as of PHP 8.2.0. Relying on this function is highly discouraged.

In my particular case the website's response time goes from ~200 ms to 3000-4000 seconds, when using MySQL as the database, where the deprecated error is logged 1012 times for each page load.

For a website using XML as the database, it is likely that the website will become unresponsive once the SMLog.xml.php file reaches a certain size, which will probably happen soon after upgrading to PHP 8.2.

Jemt commented 2 months ago

Ugly work around: Disable error logging by disabling the selected line:

image

The PHP folks have been kind enough to ensure that the call to utf8_decode(..) within the error handler does not cause an infinite loop, it seems.