Bug #75539 [Com]: Recursive call errors are not reported by preg_last_error()
Edit report at https://bugs.php.net/bug.php?id=75539&edit=1
ID: 75539
Comment by: andrew dot nester dot dev at gmail dot com
Reported by: grzegorz129 at gmail dot com
Summary: Recursive call errors are not reported by
preg_last_error()
Status: Open
Type: Bug
Package: PCRE related
Operating System: N/A
PHP Version: 7.2.0RC6
Block user comment: N
Private report: N
New Comment:
Thanks for reporting this issue! I've just added PR fixing this
Previous Comments:
------------------------------------------------------------------------
[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
Thread (3 messages)