From: Moriyoshi Koizumi Date: Wed, 30 Oct 2002 10:35:55 +0000 (+0000) Subject: Fixed mb_ereg_replace() bug X-Git-Tag: php-4.3.0RC1~423 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=45361297f355fa979cb588f6b09d7a2c5e1a9814;p=php Fixed mb_ereg_replace() bug --- diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 46aafd0c41..d85201d03b 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -496,10 +496,12 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) break; } if (err >= 0) { +#if moriyoshi_0 if ( regs.beg[0] == regs.end[0] ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression"); break; } +#endif /* copy the part of the string before the match */ _php_mb_regex_strbuf_ncat(&outdev, &string[pos], regs.beg[0] - pos); /* copy replacement and backrefs */ @@ -540,6 +542,7 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) if (pos < n) { pos = n; } else { + _php_mb_regex_strbuf_ncat(&outdev, &string[pos], 1 ); pos++; } } else { /* nomatch */