mb_ereg_replace historically has not supported escaping backslashes
with backslashes. Go back to that behavior for BC reasons.
This commit is contained in:
Nikita Popov 2019-01-08 10:21:01 +01:00
parent 7f8cab2535
commit 76c687feaf
3 changed files with 19 additions and 1 deletions

View file

@ -791,7 +791,9 @@ static inline void mb_regex_substitute(
no = onig_name_to_backref_number(regexp, (OnigUChar *)name, (OnigUChar *)name_end, regs);
break;
default:
p += clen;
/* We're not treating \ as an escape character and will interpret something like
* \\1 as \ followed by \1, rather than \\ followed by 1. This is because this
* function has not supported escaping of backslashes historically. */
smart_str_appendl(pbuf, sp, p - sp);
continue;
}