From: Dmitry Stogov Date: Tue, 14 May 2019 12:09:17 +0000 (+0300) Subject: Merge branch 'PHP-7.3' into PHP-7.4 X-Git-Tag: php-7.4.0alpha1~264 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bc4bd0229d792718fd8d9aef1fed710d24607b5;p=php Merge branch 'PHP-7.3' into PHP-7.4 * PHP-7.3: Moved NEWS entry Fixed possible crashes, because of inconsistent PCRE cache and opcache SHM reset --- 7bc4bd0229d792718fd8d9aef1fed710d24607b5 diff --cc ext/opcache/ZendAccelerator.c index 7d578c0787,a8ea054d43..58baf76e5f --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@@ -1879,10 -1906,13 +1879,10 @@@ zend_op_array *persistent_compile_file( if (!file_handle->filename || !ZCG(enabled) || !accel_startup_ok) { /* The Accelerator is disabled, act as if without the Accelerator */ return accelerator_orig_compile_file(file_handle, type); -#ifdef HAVE_OPCACHE_FILE_CACHE } else if (file_cache_only) { return file_cache_compile_file(file_handle, type); - } else if ((!ZCG(counted) && !ZCSG(accelerator_enabled)) || -#endif + } else if (!ZCG(accelerator_enabled) || (ZCSG(restart_in_progress) && accel_restart_is_active())) { -#ifdef HAVE_OPCACHE_FILE_CACHE if (ZCG(accel_directives).file_cache) { return file_cache_compile_file(file_handle, type); } @@@ -2168,10 -2205,11 +2168,8 @@@ static int persistent_stream_open_funct /* zend_resolve_path() replacement for PHP 5.3 and above */ static zend_string* persistent_zend_resolve_path(const char *filename, size_t filename_len) { - if (ZCG(enabled) && accel_startup_ok && - if ( -#ifdef HAVE_OPCACHE_FILE_CACHE -- !file_cache_only && - (ZCG(counted) || ZCSG(accelerator_enabled)) && - !ZCSG(restart_in_progress)) { -#endif ++ if (!file_cache_only && + ZCG(accelerator_enabled)) { /* check if callback is called from include_once or it's a main request */ if ((!EG(current_execute_data) && @@@ -2313,7 -2358,8 +2311,8 @@@ int accel_activate(INIT_FUNC_ARGS zend_alter_ini_entry_chars(key, "0", 1, ZEND_INI_SYSTEM, ZEND_INI_STAGE_RUNTIME); zend_string_release_ex(key, 0); zend_accel_error(ACCEL_LOG_WARNING, "Can't cache files in chroot() directory with too big inode"); + ZCG(accelerator_enabled) = 0; - return; + return SUCCESS; } } } @@@ -2391,15 -2436,11 +2393,17 @@@ realpath_cache_clean(); accel_reset_pcre_cache(); + ZCG(pcre_reseted) = 0; } else if (reset_pcre) { accel_reset_pcre_cache(); + ZCG(pcre_reseted) = 1; } + + if (ZCSG(preload_script)) { + preload_activate(); + } + + return SUCCESS; } int accel_post_deactivate(void) diff --cc ext/opcache/zend_accelerator_module.c index f013fb9db9,5b43a55202..fd35098c9e --- a/ext/opcache/zend_accelerator_module.c +++ b/ext/opcache/zend_accelerator_module.c @@@ -433,9 -438,13 +433,7 @@@ void zend_accel_info(ZEND_MODULE_INFO_F { php_info_print_table_start(); - if (ZCG(enabled) && accel_startup_ok && - ((ZCG(counted) || ZCSG(accelerator_enabled)) || file_cache_only) - if ( -#ifdef HAVE_OPCACHE_FILE_CACHE - (ZCG(accelerator_enabled) || file_cache_only) -#else - (ZCG(accelerator_enabled)) -#endif -- ) { ++ if (ZCG(accelerator_enabled) || file_cache_only) { php_info_print_table_row(2, "Opcode Caching", "Up and Running"); } else { php_info_print_table_row(2, "Opcode Caching", "Disabled"); @@@ -597,8 -608,9 +595,8 @@@ static ZEND_FUNCTION(opcache_get_status array_init(return_value); /* Trivia */ - add_assoc_bool(return_value, "opcache_enabled", ZCG(enabled) && (ZCG(counted) || ZCSG(accelerator_enabled))); + add_assoc_bool(return_value, "opcache_enabled", ZCG(accelerator_enabled)); -#ifdef HAVE_OPCACHE_FILE_CACHE if (ZCG(accel_directives).file_cache) { add_assoc_string(return_value, "file_cache", ZCG(accel_directives).file_cache); }