From: ralph at deboom dot biz
Operating system: Debian Etch 4.0+
PHP version: 5.2.6
PHP Bug Type: PCRE related
Bug description: Recursive Capturing Subpattern
Description:
------------
A recursive subpattern turns out to overwrite data of the previous matched
call... Thus it will only show the last recursive match it made in the
pattern...
Reproduce code:
---------------
$value = 'sub.sub2.sub3.sub4.domain.ext';
if
(preg_match("/^(([a-z0-9]+)(([\.|\-]{1}[a-z0-9]+)|(?R))*\.([a-z]{2,6}))$/i",
$value, $match)) {
print_R($match);
}
Expected result:
----------------
Array
(
[0] => sub.sub2.sub3.sub4.domain.ext
[1] => sub.sub2.sub3.sub4.domain.ext
[2] => sub
[3] => .sub2.sub3.sub4.domain
[4] => .sub2.sub3.sub4.domain
[5] => ext
)
Actual result:
--------------
Array
(
[0] => sub.sub2.sub3.sub4.domain.ext
[1] => sub.sub2.sub3.sub4.domain.ext
[2] => sub
[3] => .domain
[4] => .domain
[5] => ext
)
--
Edit bug report at http://bugs.php.net/?id=45260&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=45260&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=45260&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=45260&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=45260&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=45260&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=45260&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=45260&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=45260&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=45260&r=support
Expected behavior: http://bugs.php.net/fix.php?id=45260&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=45260&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=45260&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=45260&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45260&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=45260&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=45260&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=45260&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=45260&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=45260&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=45260&r=mysqlcfg