We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f80b1b0 + 3c98c2d commit 5e4c6deCopy full SHA for 5e4c6de
ext/mbstring/php_mbregex.c
@@ -713,8 +713,7 @@ static inline void mb_regex_substitute(
713
sp = p; /* save position */
714
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
715
if (clen != 1 || p == eos) {
716
- /* skip escaped multibyte char */
717
- p += clen;
+ /* skip backslash followed by multibyte char */
718
smart_str_appendl(pbuf, sp, p - sp);
719
continue;
720
}
ext/mbstring/tests/bug77514.phpt
@@ -0,0 +1,11 @@
1
+--TEST--
2
+Bug #77514: mb_ereg_replace() with trailing backslash adds null byte
3
+--FILE--
4
+<?php
5
+
6
+$a="abc123";
7
+var_dump(mb_ereg_replace("123","def\\",$a));
8
9
+?>
10
+--EXPECT--
11
+string(7) "abcdef\"
0 commit comments