diff options
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r-- | ext/mbstring/php_mbregex.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 63f84c52b2..488a999b8f 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -557,7 +557,12 @@ _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option) } } else { /* nomatch */ /* stick that last bit of string on our output */ - _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], string_len - pos); + int l = string_len - pos; + if (l > 0) { + _php_mb_regex_strbuf_ncat(&outdev, (const unsigned char *)&string[pos], l); + } else { + outdev.pos += l; + } } } @@ -1083,3 +1088,12 @@ PHP_FUNCTION(mb_regex_set_options) /* }}} */ #endif /* HAVE_MBREGEX */ + +/* + * Local variables: + * tab-width: 4 + * c-basic-offset: 4 + * End: + * vim600: fdm=marker + * vim: noet sw=4 ts=4 + */ |