Doc #77789 [NEW]: Undocumented E_WARNINGs raised in invalid regexps

From: Date: Sun, 24 Mar 2019 11:00:43 +0000
Subject: Doc #77789 [NEW]: Undocumented E_WARNINGs raised in invalid regexps
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16510@lists.php.net to get a copy of this message
From: beebware at gmail dot com Operating system: PHP version: 7.3.3 Package: *Regular Expressions Bug Type: Documentation Problem Bug description:Undocumented E_WARNINGs raised in invalid regexps Description: ------------ --- From manual page: https://php.net/function.preg-replace --- The documentation states: ``` Errors/Exceptions ¶ As of PHP 5.5.0 E_DEPRECATED level error is emitted when passing in the "\e" modifier. As of PHP 7.0.0 E_WARNING is emitted in this case and "\e" modifier has no effect. ``` However, E_WARNING s are raised if the regular expression is invalid. I feel that just adding a comment in the 'Errors/Exceptions' part of the documentation that 'E_WARNINGs will be raised if an error occurs. NULL will will be returned and preg_last_error will be populated.' will suffice, but ideally (and this would probably require a code change) a way of stopping the E_WARNINGSs being emitted would be the 'best solution'. Test script: --------------- https://3v4l.org/ULXiT <?php var_dump(preg_replace('/aodjsoidjas','','tester')); Expected result: ---------------- No E_WARNING raised, but NULL to be returned and preg_last_error to be populated. Actual result: -------------- E_WARNING is raised (not documented), but NULL to be returned and preg_last_error to be populated. ``` Warning: preg_replace(): No ending delimiter '/' found in /in/ULXiT on line 3 NULL ``` -- Edit bug report at https://bugs.php.net/bug.php?id=77789&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77789&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77789&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77789&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77789&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77789&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77789&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77789&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77789&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77789&r=support Expected behavior: https://bugs.php.net/fix.php?id=77789&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77789&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77789&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77789&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77789&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77789&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77789&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77789&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77789&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77789&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77789&r=mysqlcfg

« previous php.doc.bugs (#16510) next »