]> granicus.if.org Git - php/commitdiff
fixed #43994 mb_ereg 'successfully' matching incorrectly.
authorRui Hirokawa <hirokawa@php.net>
Sat, 16 Feb 2008 11:46:03 +0000 (11:46 +0000)
committerRui Hirokawa <hirokawa@php.net>
Sat, 16 Feb 2008 11:46:03 +0000 (11:46 +0000)
ext/mbstring/php_mbregex.c

index 3996600ebb9dff0df9683676418f91895ac4b1e7..bb49e591543fafa910cd54d0ecedef7cca864aca 100644 (file)
@@ -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;