]> granicus.if.org Git - php/commitdiff
Safer way to call pcre_fullinfo - bug 60986
authorRasmus Lerdorf <rasmus@php.net>
Mon, 6 Feb 2012 18:18:53 +0000 (18:18 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Mon, 6 Feb 2012 18:18:53 +0000 (18:18 +0000)
ext/pcre/php_pcre.c

index fc96ef6bef966460ffc26150a9f629c4b0b11f80..c9d707280cdd3d5c04c6786100deb29b40a29c1f 100644 (file)
@@ -241,6 +241,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
        char                            *pattern;
        int                                      do_study = 0;
        int                                      poptions = 0;
+       int                             count = 0;
        unsigned const char *tables = NULL;
 #if HAVE_SETLOCALE
        char                            *locale = setlocale(LC_CTYPE, NULL);
@@ -255,7 +256,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
                 * We use a quick pcre_fullinfo() check to see whether cache is corrupted, and if it
                 * is, we flush it and compile the pattern from scratch.
                 */
-               if (pcre_fullinfo(pce->re, NULL, NULL, NULL) == PCRE_ERROR_BADMAGIC) {
+               if (pcre_fullinfo(pce->re, NULL, PCRE_INFO_CAPTURECOUNT, &count) == PCRE_ERROR_BADMAGIC) {
                        zend_hash_clean(&PCRE_G(pcre_cache));
                } else {
 #if HAVE_SETLOCALE