Bug #75539 [Opn->Csd]: Recursive call errors are not reported by preg_last_error()
| From: | ab@php.net | Date: | Tue, 21 Nov 2017 19:28:09 +0000 |
| Subject: | Bug #75539 [Opn->Csd]: Recursive call errors are not reported by preg_last_error() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212664@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75539&edit=1
ID: 75539
Updated by: ab@php.net
Reported by: grzegorz129 at gmail dot com
Summary: Recursive call errors are not reported by
preg_last_error()
-Status: Open
+Status: Closed
Type: Bug
Package: PCRE related
Operating System: N/A
PHP Version: 7.2.0RC6
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of andrew.nester.dev@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8fdef981ef940dfc2f1b21cfa3f227150472ad2d
Log: Fixed #75539 and #74183 - preg_last_error not returning error code after error
Previous Comments:
------------------------------------------------------------------------
[2017-11-21 11:45:09] andrew dot nester dot dev at gmail dot com
Thanks for reporting this issue! I've just added PR fixing this
------------------------------------------------------------------------
[2017-11-20 00:47:53] grzegorz129 at gmail dot com
Description:
------------
I found a strange (yet consistent across since 5.6) regarding infinite loop patterns error
reporting. preg_match() correctly identifies broken patterns and triggers E_WARN, however
preg_last_error() returns PREG_NO_ERROR instead of expected PREG_RECURSION_LIMIT_ERROR.
It may be related to https://bugs.php.net/bug.php?id=74183
Test script:
---------------
<?php
// Test at https://3v4l.org/UkeMa
var_dump(preg_match('/((?1)?z)/', ''));
var_dump(preg_last_error() === \PREG_NO_ERROR);
Expected result:
----------------
- preg_match() returning false
- preg_last_error() returning value of PREG_RECURSION_LIMIT_ERROR
Actual result:
--------------
- preg_match() returns false
- preg_last_error() returns value of PREG_NO_ERROR
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75539&edit=1