Bug #75539 [NEW]: Recursive call errors are not reported by preg_last_error()
| From: | grzegorz129 at gmail dot com | Date: | Mon, 20 Nov 2017 00:47:53 +0000 |
| Subject: | Bug #75539 [NEW]: Recursive call errors are not reported by preg_last_error() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-212628@lists.php.net to get a copy of this message | ||
From: grzegorz129 at gmail dot com
Operating system: N/A
PHP version: 7.2.0RC6
Package: PCRE related
Bug Type: Bug
Bug description:Recursive call errors are not reported by preg_last_error()
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 bug report at https://bugs.php.net/bug.php?id=75539&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75539&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75539&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75539&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75539&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75539&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75539&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75539&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75539&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75539&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75539&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75539&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75539&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75539&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75539&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75539&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75539&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75539&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75539&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75539&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75539&r=mysqlcfg