mirror of
https://github.com/php/php-src.git
synced 2025-08-20 17:34:35 +02:00
Reduce scope of preload compiler_options
Only set preloading compiler_options while executing the preload file, not when performing linking afterwards. Otherwise options like IGNORE_INTERNAL_CLASSES will hide classes from inheritance verification.
This commit is contained in:
parent
b702ad14c9
commit
27800441b5
1 changed files with 15 additions and 15 deletions
|
@ -4451,13 +4451,14 @@ static int preload_autoload(zend_string *filename)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int accel_preload(const char *config)
|
static int accel_preload(const char *config, zend_bool in_child)
|
||||||
{
|
{
|
||||||
zend_file_handle file_handle;
|
zend_file_handle file_handle;
|
||||||
int ret;
|
int ret;
|
||||||
char *orig_open_basedir;
|
char *orig_open_basedir;
|
||||||
size_t orig_map_ptr_last;
|
size_t orig_map_ptr_last;
|
||||||
zval *zv;
|
zval *zv;
|
||||||
|
uint32_t orig_compiler_options;
|
||||||
|
|
||||||
ZCG(enabled) = 0;
|
ZCG(enabled) = 0;
|
||||||
ZCG(accelerator_enabled) = 0;
|
ZCG(accelerator_enabled) = 0;
|
||||||
|
@ -4474,6 +4475,17 @@ static int accel_preload(const char *config)
|
||||||
preload_scripts = emalloc(sizeof(HashTable));
|
preload_scripts = emalloc(sizeof(HashTable));
|
||||||
zend_hash_init(preload_scripts, 0, NULL, NULL, 0);
|
zend_hash_init(preload_scripts, 0, NULL, NULL, 0);
|
||||||
|
|
||||||
|
orig_compiler_options = CG(compiler_options);
|
||||||
|
if (in_child) {
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_PRELOAD_IN_CHILD;
|
||||||
|
}
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_PRELOAD;
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_DELAYED_BINDING;
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION;
|
||||||
|
CG(compiler_options) |= ZEND_COMPILE_IGNORE_OTHER_FILES;
|
||||||
|
|
||||||
zend_try {
|
zend_try {
|
||||||
zend_op_array *op_array;
|
zend_op_array *op_array;
|
||||||
|
|
||||||
|
@ -4512,6 +4524,7 @@ static int accel_preload(const char *config)
|
||||||
} zend_end_try();
|
} zend_end_try();
|
||||||
|
|
||||||
PG(open_basedir) = orig_open_basedir;
|
PG(open_basedir) = orig_open_basedir;
|
||||||
|
CG(compiler_options) = orig_compiler_options;
|
||||||
accelerator_orig_compile_file = preload_orig_compile_file;
|
accelerator_orig_compile_file = preload_orig_compile_file;
|
||||||
ZCG(enabled) = 1;
|
ZCG(enabled) = 1;
|
||||||
|
|
||||||
|
@ -4809,7 +4822,6 @@ static int accel_finish_startup(void)
|
||||||
char *(*orig_getenv)(const char *name, size_t name_len) = sapi_module.getenv;
|
char *(*orig_getenv)(const char *name, size_t name_len) = sapi_module.getenv;
|
||||||
size_t (*orig_ub_write)(const char *str, size_t str_length) = sapi_module.ub_write;
|
size_t (*orig_ub_write)(const char *str, size_t str_length) = sapi_module.ub_write;
|
||||||
void (*orig_flush)(void *server_context) = sapi_module.flush;
|
void (*orig_flush)(void *server_context) = sapi_module.flush;
|
||||||
uint32_t orig_compiler_options = CG(compiler_options);
|
|
||||||
#ifdef ZEND_SIGNALS
|
#ifdef ZEND_SIGNALS
|
||||||
zend_bool old_reset_signals = SIGG(reset);
|
zend_bool old_reset_signals = SIGG(reset);
|
||||||
#endif
|
#endif
|
||||||
|
@ -4903,16 +4915,6 @@ static int accel_finish_startup(void)
|
||||||
sapi_module.ub_write = preload_ub_write;
|
sapi_module.ub_write = preload_ub_write;
|
||||||
sapi_module.flush = preload_flush;
|
sapi_module.flush = preload_flush;
|
||||||
|
|
||||||
if (in_child) {
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_PRELOAD_IN_CHILD;
|
|
||||||
}
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_PRELOAD;
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_HANDLE_OP_ARRAY;
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES;
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_DELAYED_BINDING;
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION;
|
|
||||||
CG(compiler_options) |= ZEND_COMPILE_IGNORE_OTHER_FILES;
|
|
||||||
|
|
||||||
zend_interned_strings_switch_storage(1);
|
zend_interned_strings_switch_storage(1);
|
||||||
|
|
||||||
#ifdef ZEND_SIGNALS
|
#ifdef ZEND_SIGNALS
|
||||||
|
@ -4945,7 +4947,7 @@ static int accel_finish_startup(void)
|
||||||
ZCG(cwd_key_len) = 0;
|
ZCG(cwd_key_len) = 0;
|
||||||
ZCG(cwd_check) = 1;
|
ZCG(cwd_check) = 1;
|
||||||
|
|
||||||
if (accel_preload(ZCG(accel_directives).preload) != SUCCESS) {
|
if (accel_preload(ZCG(accel_directives).preload, in_child) != SUCCESS) {
|
||||||
ret = FAILURE;
|
ret = FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4966,8 +4968,6 @@ static int accel_finish_startup(void)
|
||||||
SIGG(reset) = old_reset_signals;
|
SIGG(reset) = old_reset_signals;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CG(compiler_options) = orig_compiler_options;
|
|
||||||
|
|
||||||
sapi_module.activate = orig_activate;
|
sapi_module.activate = orig_activate;
|
||||||
sapi_module.deactivate = orig_deactivate;
|
sapi_module.deactivate = orig_deactivate;
|
||||||
sapi_module.register_server_variables = orig_register_server_variables;
|
sapi_module.register_server_variables = orig_register_server_variables;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue