Commit eb1d45bd425 for php.net
commit eb1d45bd425a16f4ca891648051e5f2b660429aa
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Tue Jan 20 15:48:01 2026 +0100
Restore opcache_invalidate() fuzzer behavior
The zend_exception_save() and zend_exception_restore() functions were removed in
GH-20256. However, the fuzzer expects to be able to call opcache_invalidate()
even if there was an exception thrown. I'm not sure why exactly, but let's
restore the previous behavior.
Closes OSS-Fuzz #476466130
diff --git a/sapi/fuzzer/fuzzer-execute-common.h b/sapi/fuzzer/fuzzer-execute-common.h
index ef2ff4ee79b..81b38df40da 100644
--- a/sapi/fuzzer/fuzzer-execute-common.h
+++ b/sapi/fuzzer/fuzzer-execute-common.h
@@ -134,6 +134,8 @@ ZEND_ATTRIBUTE_UNUSED static void create_file(void) {
ZEND_ATTRIBUTE_UNUSED static void opcache_invalidate(void) {
steps_left = MAX_STEPS;
+ zend_object *exception = EG(exception);
+ EG(exception) = NULL;
zval retval, args[2];
zend_function *fn = zend_hash_str_find_ptr(CG(function_table), ZEND_STRL("opcache_invalidate"));
ZEND_ASSERT(fn != NULL);
@@ -144,4 +146,5 @@ ZEND_ATTRIBUTE_UNUSED static void opcache_invalidate(void) {
ZEND_ASSERT(Z_TYPE(retval) == IS_TRUE);
zval_ptr_dtor(&args[0]);
zval_ptr_dtor(&retval);
+ EG(exception) = exception;
}