cvs: php-src(PHP_5_0) /ext/pcre php_pcre.c

From: Date: Tue, 24 May 2005 22:11:39 +0000
Subject: cvs: php-src(PHP_5_0) /ext/pcre php_pcre.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32003@lists.php.net to get a copy of this message
andrei Tue May 24 18:11:39 2005 EDT Modified files: (Branch: PHP_5_0) /php-src/ext/pcre php_pcre.c Log: MFH http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.157.2.3&r2=1.157.2.4&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.157.2.3 php-src/ext/pcre/php_pcre.c:1.157.2.4 --- php-src/ext/pcre/php_pcre.c:1.157.2.3 Wed Aug 25 16:48:25 2004 +++ php-src/ext/pcre/php_pcre.c Tue May 24 18:11:39 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.157.2.3 2004/08/25 20:48:25 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.157.2.4 2005/05/24 22:11:39 andrei Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -161,14 +161,22 @@ back the compiled pattern, otherwise go on and compile it. */ regex_len = strlen(regex); if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) { + /* + * We use a quick pcre_info() check to see whether cache is corrupted, and if it + * is, we flush it and compile the pattern from scratch. + */ + if (pcre_info(pce->re, NULL, NULL) == PCRE_ERROR_BADMAGIC) { + zend_hash_clean(&PCRE_G(pcre_cache)); + } else { #if HAVE_SETLOCALE - if (!strcmp(pce->locale, locale)) { + if (!strcmp(pce->locale, locale)) { #endif - *extra = pce->extra; - *preg_options = pce->preg_options; - *compile_options = pce->compile_options; - return pce->re; + *extra = pce->extra; + *preg_options = pce->preg_options; + *compile_options = pce->compile_options; + return pce->re; #if HAVE_SETLOCALE + } } #endif }

« previous php.cvs (#32003) next »