Browse Source
Fixed #75539 and #74183 - preg_last_error not returning error code after error
pull/2928/merge
Fixed #75539 and #74183 - preg_last_error not returning error code after error
pull/2928/merge
committed by
Anatol Belski
3 changed files with 36 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||
--TEST-- |
|||
Bug #74183 - preg_last_error not returning error code after error |
|||
--FILE-- |
|||
<?php |
|||
|
|||
$sRegex = "/([A-Z]|[a-z]|[0-9]| |Ñ|ñ|!|"|%|&|'|´|-|:|;|>|=|<|@|_|,|\{|\}|`|~|á|é|í|ó|ú|Á|É|Í|Ó|Ú|ü|Ü){1,300}/"; |
|||
$sTest = "Hello world"; |
|||
|
|||
var_dump(preg_match($sRegex, $sTest)); |
|||
var_dump(preg_last_error() === \PREG_INTERNAL_ERROR); |
|||
?> |
|||
--EXPECTF-- |
|||
Warning: preg_match(): Compilation failed: regular expression is too large at offset %s in %s on line %s |
|||
bool(false) |
|||
bool(true) |
|||
@ -0,0 +1,13 @@ |
|||
--TEST-- |
|||
Bug #75539 - Recursive call errors are not reported by preg_last_error() |
|||
--FILE-- |
|||
<?php |
|||
|
|||
var_dump(preg_match('/((?1)?z)/', '')); |
|||
var_dump(preg_last_error() === \PREG_INTERNAL_ERROR); |
|||
|
|||
?> |
|||
--EXPECTF-- |
|||
Warning: preg_match(): Compilation failed: recursive call could loop indefinitely at offset %s in %s on line %s |
|||
bool(false) |
|||
bool(true) |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue