PHP Deprecated usage of preg_match()
-
Since PHP 8.2 (Probably more like 8.0 but we’ve updated straight to 8.2) we’ve got the following PHP error:
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/wp/disk/wordpress/wp-content/plugins/webp-express/webp-express.php on line 45
The problem is the following line:
if( preg_match( '/webp-express-web-service$/', $requestUriNoQS ) )
Which should be like below to avoid errors:
if( $requestUriNoQS AND preg_match( '/webp-express-web-service$/', $requestUriNoQS ) )
- The topic ‘PHP Deprecated usage of preg_match()’ is closed to new replies.