#47590 [NEW]: Discrepancy between documentation and reality for PCRE

From: Date: Fri, 06 Mar 2009 17:23:44 +0000
Subject: #47590 [NEW]: Discrepancy between documentation and reality for PCRE
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1949@lists.php.net to get a copy of this message
From: johan at qx dot se Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Discrepancy between documentation and reality for PCRE Description: ------------ In http://se.php.net/manual/en/regexp.reference.php, it is stated that (copy-paste): "All non-alphanumeric characters other than \, -, ^ (at the start) and the terminating ] are non-special in character classes, but it does no harm if they are escaped." I suggest that you change this to: "All non-alphanumeric characters other than /, \, -, ^ (at the start) and the terminating ] are non-special in character classes, but it does no harm if they are escaped." However, the '/' (slash) character is still considered a pattern terminator within a character class. Reproduce code: --------------- Code: preg_match_all('/[^/]*/uU', $str, $match); Expected result: ---------------- Expected: preg_match_all to find relevant results Actual result: -------------- Actual result: preg_match_all() [function.preg-match-all]: Unknown modifier ']' And this is due to the fact that the / in [^/] is considered to terminate the pattern, and thus the following character ] is considered to be a pattern modifier. -- Edit bug report at http://bugs.php.net/?id=47590&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47590&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47590&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47590&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47590&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47590&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47590&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47590&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47590&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47590&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47590&r=support Expected behavior: http://bugs.php.net/fix.php?id=47590&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47590&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47590&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47590&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47590&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=47590&r=dst IIS Stability: http://bugs.php.net/fix.php?id=47590&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=47590&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=47590&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=47590&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=47590&r=mysqlcfg

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