Bug #72704 [NEW]: mb_ereg & mb_ereg_search do not return named captures

From: 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

« previous php.bugs (#202693) next »