rasmus                                   Mon, 06 Feb 2012 18:18:53 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=323097

Log:
Safer way to call pcre_fullinfo - bug 60986

Bug: https://bugs.php.net/60986 (Critical) pcre_get_compiled_regex_cache: 
php_pcre.c: undefined reference to 'pcre_info'
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c
    U   php/php-src/branches/PHP_5_4/ext/pcre/php_pcre.c
    U   php/php-src/trunk/ext/pcre/php_pcre.c

Modified: php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c    2012-02-06 18:11:56 UTC 
(rev 323096)
+++ php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c    2012-02-06 18:18:53 UTC 
(rev 323097)
@@ -241,6 +241,7 @@
        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 @@
                 * 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

Modified: php/php-src/branches/PHP_5_4/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pcre/php_pcre.c    2012-02-06 18:11:56 UTC 
(rev 323096)
+++ php/php-src/branches/PHP_5_4/ext/pcre/php_pcre.c    2012-02-06 18:18:53 UTC 
(rev 323097)
@@ -241,6 +241,7 @@
        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 @@
                 * 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

Modified: php/php-src/trunk/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/trunk/ext/pcre/php_pcre.c       2012-02-06 18:11:56 UTC (rev 
323096)
+++ php/php-src/trunk/ext/pcre/php_pcre.c       2012-02-06 18:18:53 UTC (rev 
323097)
@@ -241,6 +241,7 @@
        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 @@
                 * 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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to