From 3550f3d0aad6e979e2a6fe3ee40d4fbff168c34b Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 30 Jul 2013 17:35:19 +0400 Subject: [PATCH] Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on shutdown). --- NEWS | 4 ++++ ext/opcache/ZendAccelerator.c | 12 +++++++----- ext/opcache/ZendAccelerator.h | 1 + ext/opcache/zend_accelerator_module.c | 1 + 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 57b523eb3a..d21126d45a 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,10 @@ PHP NEWS . Fixed bug #65291 (get_defined_constants() causes PHP to crash in a very limited case). (Arpad) +- OPcahce: + . Fixed bug #65338 (Enabling both php_opcache and php_wincache AVs on + shutdown). (Dmitry) + - PDO_mysql: . Fixed bug #65299 (pdo mysql parsing errors). (Johannes) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 76a33206ec..b5474c0507 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -2656,12 +2656,9 @@ static void accel_free_ts_resources() #endif } -static void accel_shutdown(zend_extension *extension) +void accel_shutdown(TSRMLS_D) { zend_ini_entry *ini_entry; - TSRMLS_FETCH(); - - (void)extension; /* keep the compiler happy */ zend_accel_blacklist_shutdown(&accel_blacklist); @@ -2679,6 +2676,11 @@ static void accel_shutdown(zend_extension *extension) } #if ZEND_EXTENSION_API_NO > PHP_5_3_X_API_NO +# ifndef ZTS + zend_hash_clean(CG(function_table)); + zend_hash_clean(CG(class_table)); + zend_hash_clean(EG(zend_constants)); +# endif CG(interned_strings_start) = orig_interned_strings_start; CG(interned_strings_end) = orig_interned_strings_end; zend_new_interned_string = orig_new_interned_string; @@ -2768,7 +2770,7 @@ ZEND_EXT_API zend_extension zend_extension_entry = { "http://www.zend.com/", /* URL */ "Copyright (c) 1999-2013", /* copyright */ accel_startup, /* startup */ - accel_shutdown, /* shutdown */ + NULL, /* shutdown */ accel_activate, /* per-script activation */ accel_deactivate, /* per-script deactivation */ NULL, /* message handler */ diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 5f414f2bda..57e2e7a0c5 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -316,6 +316,7 @@ extern zend_accel_globals accel_globals; extern char *zps_api_failure_reason; +void accel_shutdown(TSRMLS_D); void zend_accel_schedule_restart(zend_accel_restart_reason reason TSRMLS_DC); void zend_accel_schedule_restart_if_necessary(zend_accel_restart_reason reason TSRMLS_DC); int zend_accel_invalidate(const char *filename, int filename_len, zend_bool force TSRMLS_DC); diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c index fa4e3d85b7..2287d1353c 100644 --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@ -378,6 +378,7 @@ static ZEND_MSHUTDOWN_FUNCTION(zend_accelerator) (void)type; /* keep the compiler happy */ UNREGISTER_INI_ENTRIES(); + accel_shutdown(TSRMLS_C); return SUCCESS; } -- 2.40.0