• Resolved Pat K

    (@blackcapdesign)


    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

    • This topic was modified 2 years, 1 month ago by Pat K.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Pat K

    (@blackcapdesign)

    An important follow up to my previous message about the PHP error. The reason I was debugging this is because the plugin was not automatically generating the cache directory. And even after manually creating the directory, the plugin was not working. I did a ton of troubleshooting, including deactivating plugins etc with zero effect. As soon as I modified the adaptive-images-admin.php file as outlined above (escaping that single hyphen) the plugin was able to create the cache directory.
    pk

    Plugin Author Takis Bouyouris

    (@nevma)

    Hello, @blackcapdesign,

    Thank you for the time you took to check this out and provide this feedback. Indeed this change in regular expressions has happened in the latest versions of PHP and I will make sure it is fixed in the Adaptive Images plugin as soon as possible!

    Cheers,
    Takis

    Thread Starter Pat K

    (@blackcapdesign)

    Thanks Takis. I look forward to the updated version of your plugin.

    Plugin Author Takis Bouyouris

    (@nevma)

    You are very welcome!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Print Debug PHP Error’ is closed to new replies.