Print Debug PHP Error
-
Hello and thank you for sharing your excellent plugin! While doing some debugging I noticed a persistent PHP error in the server logs. This is an edited excerpt of the PHP error:
[proxy_fcgi:error] ... Got error 'PHP message: PHP Warning: preg_replace(): Compilation failed: invalid range in character class at offset 10 in /var/www/vhosts/example.com/httpdocs/wp-content/plugins/adaptive-images/adaptive-images-admin.php on line 937', referer: https://www.example.com/wp-admin/options-general.php?page=adaptive-images&action=print-debug-info&_wpnonce=48eeb00088
I am running the latest version of WordPress (v6.0.2) & the Adaptive Images plugin (v0.6.70) – PHP v7.4.32 w Apache.
I think the error is due to more strict PHP requirements in PHP 7.4 for processing regular expressions; in this case some hyphens need to be escaped. I replaced this:
$cache_directory = preg_replace( '/[^a-zA-Z\d-_\/]+/i', '', $cache_directory );
With this:
$cache_directory = preg_replace( '/[^a-zA-Z\d\-_\/]+/i', '', $cache_directory );
…and the errors stopped.
Hopefully this can be addressed in the next plugin release.
Cheers,
pk
- The topic ‘Print Debug PHP Error’ is closed to new replies.