Bug #74183 [Opn]: preg_last_error not returning error code after error

From: Date: Tue, 28 Feb 2017 17:48:03 +0000
Subject: Bug #74183 [Opn]: preg_last_error not returning error code after error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207612@lists.php.net to get a copy of this message
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)

« previous php.bugs (#207612) next »