Bug #72704 [NEW]: mb_ereg & mb_ereg_search do not return named captures
| From: | ju1ius at laposte dot net | Date: | Fri, 29 Jul 2016 04:17:07 +0000 |
| Subject: | Bug #72704 [NEW]: mb_ereg & mb_ereg_search do not return named captures | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-202693@lists.php.net to get a copy of this message | ||
From: ju1ius at laposte dot net
Operating system: Debian Sid
PHP version: 5.6.24
Package: mbstring related
Bug Type: Bug
Bug description:mb_ereg & mb_ereg_search do not return named captures
Description:
------------
mb_ereg, mb_ereg_search_regs & mb_ereg_search_getregs
return only
numbered capturing groups, but they should return both numbered and
named capturing groups.
Test script:
---------------
mb_regex_encoding("UTF-8");
mb_ereg('(?<wsp>\s*)(?<word>\w+)', ' ä¸å½', $m);
var_dump($m);
mb_ereg_search_init(' ä¸å½ï¼');
mb_ereg_search('(?<wsp>\s*)(?<word>\w+)(?<punct>[ï¼ï¼])');
var_dump(mb_ereg_search_getregs());
Expected result:
----------------
array(5) {
[0]=>
string(8) " ä¸å½"
[1]=>
string(2) " "
[2]=>
string(6) "ä¸å½"
["wsp"]=>
string(2) " "
["word"]=>
string(6) "ä¸å½"
}
array(7) {
[0]=>
string(11) " ä¸å½ï¼"
[1]=>
string(2) " "
[2]=>
string(6) "ä¸å½"
[3]=>
string(3) "ï¼"
["punct"]=>
string(3) "ï¼"
["wsp"]=>
string(2) " "
["word"]=>
string(6) "ä¸å½"
}
Actual result:
--------------
array(3) {
[0]=>
string(8) " ä¸å½"
[1]=>
string(2) " "
[2]=>
string(6) "ä¸å½"
}
array(4) {
[0]=>
string(11) " ä¸å½ï¼"
[1]=>
string(2) " "
[2]=>
string(6) "ä¸å½"
[3]=>
string(3) "ï¼"
}
--
Edit bug report at https://bugs.php.net/bug.php?id=72704&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72704&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72704&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72704&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72704&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72704&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72704&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72704&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72704&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72704&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72704&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72704&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72704&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72704&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72704&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72704&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72704&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72704&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72704&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72704&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72704&r=mysqlcfg