diff options
author | Andrey Hristov <andrey@php.net> | 1999-07-05 15:25:51 +0000 |
---|---|---|
committer | Andrey Hristov <andrey@php.net> | 1999-07-05 15:25:51 +0000 |
commit | 7aa981f5b73ced8d28647e497d6023fac20e369a (patch) | |
tree | fa97f8e764bfccc35cddf176e8b7131a2252a985 | |
parent | f6164dbf3a29a744adce732d658236d6a9f7e85b (diff) | |
download | php-git-7aa981f5b73ced8d28647e497d6023fac20e369a.tar.gz |
Correct option caching
-rw-r--r-- | ext/pcre/pcre.c | 7 | ||||
-rw-r--r-- | ext/pcre/php_pcre.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/ext/pcre/pcre.c b/ext/pcre/pcre.c index 3c8ccf2afb..6a9ca26b90 100644 --- a/ext/pcre/pcre.c +++ b/ext/pcre/pcre.c @@ -169,6 +169,7 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ char *pattern; int regex_len; int do_study = 0; + int poptions = 0; pcre_cache_entry *pce; pcre_cache_entry new_entry; PCRE_LS_FETCH(); @@ -178,6 +179,7 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ regex_len = strlen(regex); if (zend_hash_find(&PCRE_G(pcre_cache), regex, regex_len+1, (void **)&pce) == SUCCESS) { extra = pce->extra; + *preg_options = pce->preg_options; return pce->re; } @@ -240,7 +242,7 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ case 'X': coptions |= PCRE_EXTRA; break; /* Custom preg options */ - case 'e': *preg_options |= PREG_REPLACE_EVAL; break; + case 'e': poptions |= PREG_REPLACE_EVAL; break; case ' ': case '\n': @@ -275,11 +277,14 @@ static pcre* _pcre_get_compiled_regex(char *regex, pcre_extra *extra, int *preg_ } } + *preg_options = poptions; + efree(pattern); /* Store the compiled pattern and extra info in the cache. */ new_entry.re = re; new_entry.extra = extra; + new_entry.preg_options = poptions; zend_hash_update(&PCRE_G(pcre_cache), regex, regex_len+1, (void *)&new_entry, sizeof(pcre_cache_entry), NULL); diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h index 38042366f4..a367da3bd4 100644 --- a/ext/pcre/php_pcre.h +++ b/ext/pcre/php_pcre.h @@ -54,6 +54,7 @@ extern zend_module_entry pcre_module_entry; typedef struct { pcre *re; pcre_extra *extra; + int preg_options; } pcre_cache_entry; typedef struct { |