Doc #67263 [NEW]: Regex incorrect in User-defined functions doc'n

From: Date: Tue, 13 May 2014 03:49:03 +0000
Subject: Doc #67263 [NEW]: Regex incorrect in User-defined functions doc'n
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11207@lists.php.net to get a copy of this message
From: lewis dot berman at verizon dot net Operating system: Windows 7 PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:Regex incorrect in User-defined functions doc'n Description: ------------ --- From manual page: http://www.php.net/functions.user-defined --- Regex in the following text requires a leading caret ("^"): "A valid function name starts with a letter or underscore, followed by any number of letters, numbers, or underscores. As a regular expression, it would be expressed thus: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*." I.e., the regex should be ^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*. Otherwise the subject string '014A7' will match, and that is not in accordance with the text. The script was run under Bitnami wampstack-5.4.28-0. Test script: --------------- <?php $match_result = preg_match("/[a-zA-Z][a-zA-Z0-9]*./", '014A7'); echo $match_result; $match_result = preg_match("/^[a-zA-Z][a-zA-Z0-9]*./", '014A7'); echo $match_result; ?> Actual result: -------------- The script returns 0 for the first match, 1 for the second. -- Edit bug report at https://bugs.php.net/bug.php?id=67263&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=67263&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=67263&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=67263&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=67263&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=67263&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=67263&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=67263&r=needscript Try newer version: https://bugs.php.net/fix.php?id=67263&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=67263&r=support Expected behavior: https://bugs.php.net/fix.php?id=67263&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=67263&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=67263&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=67263&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=67263&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=67263&r=dst IIS Stability: https://bugs.php.net/fix.php?id=67263&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=67263&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=67263&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=67263&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=67263&r=mysqlcfg

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