Bug #74183 [Opn]: preg_last_error not returning error code after error
Edit report at https://bugs.php.net/bug.php?id=74183&edit=1
ID: 74183
User updated by: velazcomtz dot miguel at gmail dot com
Reported by: velazcomtz dot miguel at gmail dot com
Summary: preg_last_error not returning error code after error
Status: Open
Type: Bug
Package: *Regular Expressions
Operating System: Ubuntu
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
Description:
------------
---
From manual page: http://www.php.net/function.preg-last-error
---
There are cases where preg_match returns false and preg_last_error returns 0 but, when you check the
error.log file there is an error:
PHP message: PHP Warning: preg_match(): Compilation failed: regular expression is too large at
offset 128
Just as a reminder: this bug was detected and fixed previously here: https://bugs.php.net/bug.php?id=52732&edit=2
Test script:
---------------
$sRegex = "/([A-Z]|[a-z]|[0-9]|
|Ã|ñ|!|"|%|&|'|´|-|:|;|>|=|<|@|_|,|\{|\}|`|~|á|é|Ã|ó|ú|Ã|Ã|Ã|Ã|Ã|ü|Ã){1,300}/";
$sTest = "Hello world";
var_dump(preg_match($sRegex, $sTest)); // returns false
var_dump(preg_last_error()); // returns 0
Previous Comments:
------------------------------------------------------------------------
[2017-02-28 17:46:25] velazcomtz dot miguel at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.preg-last-error
---
There are cases where preg_match returns false and preg_last_error returns 0 but, when you check the
error.log file there is an error:
PHP message: PHP Warning: preg_match(): Compilation failed: regular expression is too large at
offset 128
Just as a reminder: this bug was detected and fixed previously here: https://bugs.php.net/bug.php?id=52732&edit=2
Test script:
---------------
$sRegex = "/([A-Z]|[a-z]|[0-9]|
|Ã|ñ|!|"|%|&|'|´|-|:|;|>|=|<|@|_|,|\{|\}|`|~|á|é|Ã|ó|ú|Ã|Ã|Ã|Ã|Ã|ü|Ã){1,300}/";
$sTest = "Hello world";
var_dump(preg_match($sRegex, $sTextoPrueba)); // returns false
var_dump(preg_last_error()); // returns 0
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74183&edit=1
Thread (5 messages)