Bug #72704 [Opn->Csd]: mb_ereg & mb_ereg_search do not return named captures

From: Date: Wed, 19 Sep 2018 06:28:37 +0000
Subject: Bug #72704 [Opn->Csd]: mb_ereg & mb_ereg_search do not return named captures
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217133@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72704&edit=1 ID: 72704 Updated by: nikic@php.net Reported by: ju1ius at laposte dot net Summary: mb_ereg & mb_ereg_search do not return named captures -Status: Open +Status: Closed Type: Bug Package: mbstring related Operating System: Debian Sid PHP Version: 5.6.24 -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This has been implemented in PHP 7.3 (by yourself ^^) as part of https://github.com/php/php-src/pull/2044, so I'm closing this issue. Previous Comments: ------------------------------------------------------------------------ [2016-07-29 04:17:05] ju1ius at laposte dot net 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 this bug report at https://bugs.php.net/bug.php?id=72704&edit=1

« previous php.bugs (#217133) next »