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

From: Date: Tue, 28 Feb 2017 17:46:32 +0000
Subject: Bug #74183 [NEW]: preg_last_error not returning error code after error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207611@lists.php.net to get a copy of this message
From: velazcomtz dot miguel at gmail dot com Operating system: Ubuntu PHP version: 5.6.30 Package: *Regular Expressions Bug Type: Bug Bug description:preg_last_error not returning error code after error 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 bug report at https://bugs.php.net/bug.php?id=74183&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74183&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74183&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74183&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74183&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74183&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74183&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74183&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74183&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74183&r=support Expected behavior: https://bugs.php.net/fix.php?id=74183&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74183&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74183&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74183&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74183&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74183&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74183&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74183&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74183&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74183&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74183&r=mysqlcfg

« previous php.bugs (#207611) next »