Title: Print Debug PHP Error
Last modified: October 13, 2022

---

# Print Debug PHP Error

 *  Resolved [Pat K](https://wordpress.org/support/users/blackcapdesign/)
 * (@blackcapdesign)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/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
    -  This topic was modified 3 years, 7 months ago by [Pat K](https://wordpress.org/support/users/blackcapdesign/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Thread Starter [Pat K](https://wordpress.org/support/users/blackcapdesign/)
 * (@blackcapdesign)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/print-debug-php-error/#post-16094384)
 * 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](https://wordpress.org/support/users/nevma/)
 * (@nevma)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/print-debug-php-error/#post-16094981)
 * Hello, [@blackcapdesign](https://wordpress.org/support/users/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](https://wordpress.org/support/users/blackcapdesign/)
 * (@blackcapdesign)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/print-debug-php-error/#post-16097939)
 * Thanks Takis. I look forward to the updated version of your plugin.
 *  Plugin Author [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * (@nevma)
 * [3 years, 7 months ago](https://wordpress.org/support/topic/print-debug-php-error/#post-16098834)
 * You are very welcome!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Print Debug PHP Error’ is closed to new replies.

 * ![](https://ps.w.org/adaptive-images/assets/icon-256x256.png?rev=1138642)
 * [Adaptive Images for WordPress](https://wordpress.org/plugins/adaptive-images/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/adaptive-images/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/adaptive-images/)
 * [Active Topics](https://wordpress.org/support/plugin/adaptive-images/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/adaptive-images/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/adaptive-images/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * Last activity: [3 years, 7 months ago](https://wordpress.org/support/topic/print-debug-php-error/#post-16098834)
 * Status: resolved