Bug #77428 [Opn->Csd]: mb_ereg_replace() doesn't replace a substitution variable
| From: | nikic@php.net | Date: | Tue, 08 Jan 2019 09:22:07 +0000 |
| Subject: | Bug #77428 [Opn->Csd]: mb_ereg_replace() doesn't replace a substitution variable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-218845@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
+Status: Closed
Type: Bug
Package: mbstring related
PHP Version: 7.3.0
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=76c687feaf86d305f8ba510a7319ccc1b66a8901
Log: Fixed bug #77428
Previous Comments:
------------------------------------------------------------------------
[2019-01-08 09:09:49] nikic@php.net
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.
------------------------------------------------------------------------
[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