{"id":16094365,"date":"2022-10-13T00:43:47","date_gmt":"2022-10-13T00:43:47","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/print-debug-php-error\/"},"modified":"2022-10-13T00:56:27","modified_gmt":"2022-10-13T00:56:27","slug":"print-debug-php-error","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/print-debug-php-error\/","title":{"rendered":"Print Debug PHP Error"},"content":{"rendered":"<p>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:<\/p>\n<p><code>[proxy_fcgi:error] ... Got error &#039;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&#039;, referer: https:\/\/www.example.com\/wp-admin\/options-general.php?page=adaptive-images&amp;action=print-debug-info&amp;_wpnonce=48eeb00088<\/code><\/p>\n<p>I am running the latest version of WordPress (v6.0.2) &amp; the Adaptive Images plugin (v0.6.70) &#8211; PHP v7.4.32 w Apache.<\/p>\n<p>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:<br \/>\n<code>$cache_directory = preg_replace( &#039;\/[^a-zA-Z\\d-_\\\/]+\/i&#039;, &#039;&#039;, $cache_directory );<\/code><\/p>\n<p>With this:<br \/>\n<code>$cache_directory = preg_replace( &#039;\/[^a-zA-Z\\d\\-_\\\/]+\/i&#039;, &#039;&#039;, $cache_directory );<\/code><\/p>\n<p>&#8230;and the errors stopped.<\/p>\n<p>Hopefully this can be addressed in the next plugin release.<\/p>\n<p>Cheers,<br \/>\npk<\/p>\n","protected":false},"template":"","class_list":["post-16094365","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16094365","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16094365\/revisions"}],"predecessor-version":[{"id":16094377,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/16094365\/revisions\/16094377"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=16094365"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}