Skip to content

Commit 6cb31fe

Browse files
committed
Use APPLY_STOP in pcre_clean_cache()
Once num_clean has reached 0, we never remove any more elements anyway.
1 parent 025ed70 commit 6cb31fe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/pcre/php_pcre.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,10 @@ static int pcre_clean_cache(zval *data, void *arg)
524524
if (*num_clean > 0 && !pce->refcount) {
525525
(*num_clean)--;
526526
return ZEND_HASH_APPLY_REMOVE;
527-
} else {
527+
} else if (*num_clean > 0) {
528528
return ZEND_HASH_APPLY_KEEP;
529+
} else {
530+
return ZEND_HASH_APPLY_STOP;
529531
}
530532
}
531533
/* }}} */

0 commit comments

Comments
 (0)