Bug #77428 [Opn]: mb_ereg_replace() doesn't replace a substitution variable

From: Date: Tue, 08 Jan 2019 09:09:49 +0000
Subject: Bug #77428 [Opn]: mb_ereg_replace() doesn't replace a substitution variable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218844@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77428&edit=1 ID: 77428 Updated by: nikic@php.net Reported by: shin1x1 at gmail dot com Summary: mb_ereg_replace() doesn't replace a substitution variable Status: Open Type: Bug Package: mbstring related PHP Version: 7.3.0 Block user comment: N Private report: N New Comment: Hrm, both the old and the new behavior are incorrect. The result should be "a\1c" here. '\\\1' is \\1 after unescaping, which should be a literal \ followed by a literal 1. Not sure what to do with this one... It looks like this function just did not support escaping backslashes previously, so we might just have to go back to that for BC reasons. Previous Comments: ------------------------------------------------------------------------ [2019-01-08 01:47:12] shin1x1 at gmail dot com Description: ------------ The substitution variable of mb_ereg_replace() is not working when a substitution variable is preceded by a backslash If you look at https://3v4l.org/OjhAe the output is different for prior to PHP 7.3.0. Test script: --------------- <?php var_dump(mb_ereg_replace('(%)', '\\\1', 'a%c')); Expected result: ---------------- string(4) "a\%c" Actual result: -------------- string(5) "a\\1c" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77428&edit=1

« previous php.bugs (#218844) next »