summaryrefslogtreecommitdiff
path: root/ext/mbstring/php_mbregex.c
diff options
context:
space:
mode:
authorRui Hirokawa <hirokawa@php.net>2008-02-16 11:46:03 +0000
committerRui Hirokawa <hirokawa@php.net>2008-02-16 11:46:03 +0000
commitad400f11449bec5c98b5e261ccf5d534d71f5056 (patch)
tree403acae04832e46640f327460c4e65a0e10cce9d /ext/mbstring/php_mbregex.c
parent179b37095724bd9676811e60ff016332e5833616 (diff)
downloadphp-git-ad400f11449bec5c98b5e261ccf5d534d71f5056.tar.gz
fixed #43994 mb_ereg 'successfully' matching incorrectly.
Diffstat (limited to 'ext/mbstring/php_mbregex.c')
-rw-r--r--ext/mbstring/php_mbregex.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 3996600ebb..bb49e59154 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -546,6 +546,13 @@ static void _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase)
convert_to_string_ex(arg_pattern);
/* don't bother doing an extended regex with just a number */
}
+
+ if (!Z_STRVAL_PP(arg_pattern) || Z_STRLEN_PP(arg_pattern) == 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty pattern");
+ RETVAL_FALSE;
+ goto out;
+ }
+
re = php_mbregex_compile_pattern(Z_STRVAL_PP(arg_pattern), Z_STRLEN_PP(arg_pattern), options, MBSTRG(current_mbctype), MBSTRG(regex_default_syntax) TSRMLS_CC);
if (re == NULL) {
RETVAL_FALSE;