mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
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
This commit is contained in:
commit
7bc4bd0229
@ -438,7 +438,7 @@ static zend_always_inline zend_string *accel_find_interned_string(zend_string *s
|
||||
}
|
||||
|
||||
if (!ZCG(counted)) {
|
||||
if (accel_activate_add() == FAILURE) {
|
||||
if (!ZCG(accelerator_enabled) || accel_activate_add() == FAILURE) {
|
||||
return str;
|
||||
}
|
||||
ZCG(counted) = 1;
|
||||
@ -1154,7 +1154,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
|
||||
cwd_len = ZSTR_LEN(cwd_str);
|
||||
if (ZCG(cwd_check)) {
|
||||
ZCG(cwd_check) = 0;
|
||||
if ((ZCG(counted) || ZCSG(accelerator_enabled))) {
|
||||
if (ZCG(accelerator_enabled)) {
|
||||
|
||||
zend_string *str = accel_find_interned_string(cwd_str);
|
||||
if (!str) {
|
||||
@ -1194,7 +1194,7 @@ char *accel_make_persistent_key(const char *path, size_t path_length, int *key_l
|
||||
|
||||
if (ZCG(include_path_check)) {
|
||||
ZCG(include_path_check) = 0;
|
||||
if ((ZCG(counted) || ZCSG(accelerator_enabled))) {
|
||||
if (ZCG(accelerator_enabled)) {
|
||||
|
||||
zend_string *str = accel_find_interned_string(ZCG(include_path));
|
||||
if (!str) {
|
||||
@ -1277,7 +1277,7 @@ int zend_accel_invalidate(const char *filename, size_t filename_len, zend_bool f
|
||||
zend_string *realpath;
|
||||
zend_persistent_script *persistent_script;
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -1881,7 +1881,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
|
||||
return accelerator_orig_compile_file(file_handle, type);
|
||||
} else if (file_cache_only) {
|
||||
return file_cache_compile_file(file_handle, type);
|
||||
} else if ((!ZCG(counted) && !ZCSG(accelerator_enabled)) ||
|
||||
} else if (!ZCG(accelerator_enabled) ||
|
||||
(ZCSG(restart_in_progress) && accel_restart_is_active())) {
|
||||
if (ZCG(accel_directives).file_cache) {
|
||||
return file_cache_compile_file(file_handle, type);
|
||||
@ -2168,10 +2168,8 @@ static int persistent_stream_open_function(const char *filename, zend_file_handl
|
||||
/* 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 &&
|
||||
!file_cache_only &&
|
||||
(ZCG(counted) || ZCSG(accelerator_enabled)) &&
|
||||
!ZCSG(restart_in_progress)) {
|
||||
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,6 +2311,7 @@ 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 SUCCESS;
|
||||
}
|
||||
}
|
||||
@ -2374,12 +2373,15 @@ int accel_activate(INIT_FUNC_ARGS)
|
||||
}
|
||||
accel_restart_leave();
|
||||
}
|
||||
} else {
|
||||
}
|
||||
if (!ZCG(pcre_reseted)) {
|
||||
reset_pcre = 1;
|
||||
}
|
||||
zend_shared_alloc_unlock();
|
||||
}
|
||||
|
||||
ZCG(accelerator_enabled) = ZCSG(accelerator_enabled);
|
||||
|
||||
SHM_PROTECT();
|
||||
HANDLE_UNBLOCK_INTERRUPTIONS();
|
||||
|
||||
@ -2391,8 +2393,10 @@ int accel_activate(INIT_FUNC_ARGS)
|
||||
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)) {
|
||||
|
@ -191,6 +191,8 @@ typedef struct _zend_accel_globals {
|
||||
int counted; /* the process uses shared memory */
|
||||
zend_bool enabled;
|
||||
zend_bool locked; /* thread obtained exclusive lock */
|
||||
zend_bool accelerator_enabled; /* accelerator enabled for current request */
|
||||
zend_bool pcre_reseted;
|
||||
HashTable bind_hash; /* prototype and zval lookup table */
|
||||
zend_accel_directives accel_directives;
|
||||
zend_string *cwd; /* current working directory or NULL */
|
||||
|
@ -433,9 +433,7 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
|
||||
{
|
||||
php_info_print_table_start();
|
||||
|
||||
if (ZCG(enabled) && accel_startup_ok &&
|
||||
((ZCG(counted) || ZCSG(accelerator_enabled)) || file_cache_only)
|
||||
) {
|
||||
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");
|
||||
@ -535,7 +533,7 @@ static int accelerator_get_scripts(zval *return_value)
|
||||
struct timeval exec_time;
|
||||
struct timeval fetch_time;
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
if (!ZCG(accelerator_enabled) || accelerator_shm_read_lock() != SUCCESS) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -597,7 +595,7 @@ 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));
|
||||
|
||||
if (ZCG(accel_directives).file_cache) {
|
||||
add_assoc_string(return_value, "file_cache", ZCG(accel_directives).file_cache);
|
||||
@ -879,7 +877,7 @@ static ZEND_FUNCTION(opcache_is_script_cached)
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
if (!ZCG(enabled) || !accel_startup_ok || !ZCSG(accelerator_enabled)) {
|
||||
if (!ZCG(accelerator_enabled)) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user