You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error changed if you use not a string as second argument in preg_match function from E_WARNING before 8.0 to TypeError in 8+ versions.
Code example: <?php $var = preg_match('#[0-9]#', ['test']); var_dump($var);
Result 7.4:
Warning: preg_match() expects parameter 2 to be string, array given in /home/user/scripts/code.php on line 3
bool(false)
Result 8.0:
Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /home/user/scripts/code.php:3
PS preg_match_all the same behavior
The text was updated successfully, but these errors were encountered:
Array was never a valid argument to these functions. PHP 8.0 is now throwing an error when an undefined behaviour is triggered by providing invalid parameter values. It's got nothing to do with PCRE functions.
Error changed if you use not a string as second argument in preg_match function from E_WARNING before 8.0 to TypeError in 8+ versions.
Code example:
<?php $var = preg_match('#[0-9]#', ['test']); var_dump($var);
Result 7.4:
Warning: preg_match() expects parameter 2 to be string, array given in /home/user/scripts/code.php on line 3
bool(false)
Result 8.0:
Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /home/user/scripts/code.php:3
PS preg_match_all the same behavior
The text was updated successfully, but these errors were encountered: