summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2003-09-23 02:47:06 +0000
committerRui Hirokawa <hirokawa@php.net>2003-09-23 02:47:06 +0000
commitce66e1eb8d6979a9414ee1ae9f15399edaadaab9 (patch)
tree613f37eeea08a4648dd0cb09406a47d23ad61a39 /ext/mbstring/php_mbregex.c
parentb6b761ca84b6dd4ddf76c766a7e24da6e90f3128 (diff)
downloadphp-git-ce66e1eb8d6979a9414ee1ae9f15399edaadaab9.tar.gz
fixed wrong string length in mbregex.
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 18687f7477..4a4756bcc2 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -653,8 +653,12 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int op
}
} else { /* nomatch */
/* stick that last bit of string on our output */
- if ((UChar *)(string + string_len) > pos)
- smart_str_appendl(&out_buf, pos, (size_t)((UChar *)(string + string_len) - pos));
+ int l = (UChar *)(string + string_len) - pos;
+ if (l > 0) {
+ smart_str_appendl(&out_buf, pos, l);
+ } else {
+ out_buf.len += l;
+ }
}
php_mb_regex_region_free(regs, 0);
}