Skip to content

Commit 090bb97

Browse files
committed
Safer way to call pcre_fullinfo - bug 60986
1 parent 0f0261e commit 090bb97

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/pcre/php_pcre.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
241241
char *pattern;
242242
int do_study = 0;
243243
int poptions = 0;
244+
int count = 0;
244245
unsigned const char *tables = NULL;
245246
#if HAVE_SETLOCALE
246247
char *locale = setlocale(LC_CTYPE, NULL);
@@ -255,7 +256,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(char *regex, int regex_le
255256
* We use a quick pcre_fullinfo() check to see whether cache is corrupted, and if it
256257
* is, we flush it and compile the pattern from scratch.
257258
*/
258-
if (pcre_fullinfo(pce->re, NULL, NULL, NULL) == PCRE_ERROR_BADMAGIC) {
259+
if (pcre_fullinfo(pce->re, NULL, PCRE_INFO_CAPTURECOUNT, &count) == PCRE_ERROR_BADMAGIC) {
259260
zend_hash_clean(&PCRE_G(pcre_cache));
260261
} else {
261262
#if HAVE_SETLOCALE

0 commit comments

Comments
 (0)