From: johannes dot ponader at web dot de
Operating system:
PHP version: Irrelevant
PHP Bug Type: Documentation problem
Bug description: Documentation corrup in preg_match_all
Description:
------------
Hi,
the documentation of preg_match_all seems to be corrupt.
In the *Parameters* section the description for *matches* says:
"matches
In this case, $matches[0] is the first set of matches, and
$matches[0][0] has text matched by full pattern, $matches[0][1] has text
matched by first subpattern and so on. Similarly, $matches[1] is the second
set of matches, etc. "
This applies only when the flag PREG_SET_ORDER is set (non-default).
The beginning "In this case" without giving information about which case
is meant indicates that there is something missing. The correct
documentation could be like written here in the field "Expected result".
Thanks,
Johannes Ponader
Expected result:
----------------
matches
By default, $matches[0] is an array of full pattern matches, $matches[1]
is an array of strings matched by the first parenthesized subpattern, and
so on. $matches[0][0] is the first match of the full pattern,
$matches[0][1] is the second match etc.. $matches[1][0] is the first match
of the first subpattern.
If the Flag PREG_SET_ORDER is set, the array is ordered differently. In
this case...
(continues like in actual version)
Actual result:
--------------
matches
In this case, $matches[0] is the first set of matches, and
$matches[0][0] has text matched by full pattern, $matches[0][1] has text
matched by first subpattern and so on. Similarly, $matches[1] is the second
set of matches, etc.
--
Edit bug report at http://bugs.php.net/?id=42159&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42159&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42159&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42159&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42159&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42159&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42159&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42159&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42159&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42159&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42159&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42159&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42159&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42159&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42159&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42159&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42159&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42159&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42159&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42159&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42159&r=mysqlcfg