]> granicus.if.org Git - php/commitdiff
MFH
authorMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 7 Oct 2002 16:15:36 +0000 (16:15 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Mon, 7 Oct 2002 16:15:36 +0000 (16:15 +0000)
ext/mbstring/php_mbregex.c

index 8044d18e909bc15acd4dacf847e15ef79048e933..5b231212e78694e99a741452bf10a7435311c12d 100644 (file)
@@ -430,15 +430,15 @@ php_mbereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, int option)
        pos = 0;
        while (err >= 0) {
                err = mbre_search(&re, string, string_len, pos, string_len - pos, &regs);
-               if ( regs.beg[0] == regs.end[0] ) {
-                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
-                       break;
-               }
                if (err <= -2) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "mbregex search failure in php_mbereg_replace_exec()");
                        break;
                }
                if (err >= 0) {
+                       if ( regs.beg[0] == regs.end[0] ) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Empty regular expression");
+                               break;
+                       }
                        /* copy the part of the string before the match */
                        php_mbregex_strbuf_ncat(&outdev, &string[pos], regs.beg[0] - pos);
                        /* copy replacement and backrefs */