@@ -4451,13 +4451,14 @@ static int preload_autoload(zend_string *filename)
4451
4451
return ret ;
4452
4452
}
4453
4453
4454
- static int accel_preload (const char * config )
4454
+ static int accel_preload (const char * config , zend_bool in_child )
4455
4455
{
4456
4456
zend_file_handle file_handle ;
4457
4457
int ret ;
4458
4458
char * orig_open_basedir ;
4459
4459
size_t orig_map_ptr_last ;
4460
4460
zval * zv ;
4461
+ uint32_t orig_compiler_options ;
4461
4462
4462
4463
ZCG (enabled ) = 0 ;
4463
4464
ZCG (accelerator_enabled ) = 0 ;
@@ -4474,6 +4475,17 @@ static int accel_preload(const char *config)
4474
4475
preload_scripts = emalloc (sizeof (HashTable ));
4475
4476
zend_hash_init (preload_scripts , 0 , NULL , NULL , 0 );
4476
4477
4478
+ orig_compiler_options = CG (compiler_options );
4479
+ if (in_child ) {
4480
+ CG (compiler_options ) |= ZEND_COMPILE_PRELOAD_IN_CHILD ;
4481
+ }
4482
+ CG (compiler_options ) |= ZEND_COMPILE_PRELOAD ;
4483
+ CG (compiler_options ) |= ZEND_COMPILE_HANDLE_OP_ARRAY ;
4484
+ CG (compiler_options ) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
4485
+ CG (compiler_options ) |= ZEND_COMPILE_DELAYED_BINDING ;
4486
+ CG (compiler_options ) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION ;
4487
+ CG (compiler_options ) |= ZEND_COMPILE_IGNORE_OTHER_FILES ;
4488
+
4477
4489
zend_try {
4478
4490
zend_op_array * op_array ;
4479
4491
@@ -4512,6 +4524,7 @@ static int accel_preload(const char *config)
4512
4524
} zend_end_try ();
4513
4525
4514
4526
PG (open_basedir ) = orig_open_basedir ;
4527
+ CG (compiler_options ) = orig_compiler_options ;
4515
4528
accelerator_orig_compile_file = preload_orig_compile_file ;
4516
4529
ZCG (enabled ) = 1 ;
4517
4530
@@ -4809,7 +4822,6 @@ static int accel_finish_startup(void)
4809
4822
char * (* orig_getenv )(const char * name , size_t name_len ) = sapi_module .getenv ;
4810
4823
size_t (* orig_ub_write )(const char * str , size_t str_length ) = sapi_module .ub_write ;
4811
4824
void (* orig_flush )(void * server_context ) = sapi_module .flush ;
4812
- uint32_t orig_compiler_options = CG (compiler_options );
4813
4825
#ifdef ZEND_SIGNALS
4814
4826
zend_bool old_reset_signals = SIGG (reset );
4815
4827
#endif
@@ -4903,16 +4915,6 @@ static int accel_finish_startup(void)
4903
4915
sapi_module .ub_write = preload_ub_write ;
4904
4916
sapi_module .flush = preload_flush ;
4905
4917
4906
- if (in_child ) {
4907
- CG (compiler_options ) |= ZEND_COMPILE_PRELOAD_IN_CHILD ;
4908
- }
4909
- CG (compiler_options ) |= ZEND_COMPILE_PRELOAD ;
4910
- CG (compiler_options ) |= ZEND_COMPILE_HANDLE_OP_ARRAY ;
4911
- CG (compiler_options ) |= ZEND_COMPILE_IGNORE_INTERNAL_CLASSES ;
4912
- CG (compiler_options ) |= ZEND_COMPILE_DELAYED_BINDING ;
4913
- CG (compiler_options ) |= ZEND_COMPILE_NO_CONSTANT_SUBSTITUTION ;
4914
- CG (compiler_options ) |= ZEND_COMPILE_IGNORE_OTHER_FILES ;
4915
-
4916
4918
zend_interned_strings_switch_storage (1 );
4917
4919
4918
4920
#ifdef ZEND_SIGNALS
@@ -4945,7 +4947,7 @@ static int accel_finish_startup(void)
4945
4947
ZCG (cwd_key_len ) = 0 ;
4946
4948
ZCG (cwd_check ) = 1 ;
4947
4949
4948
- if (accel_preload (ZCG (accel_directives ).preload ) != SUCCESS ) {
4950
+ if (accel_preload (ZCG (accel_directives ).preload , in_child ) != SUCCESS ) {
4949
4951
ret = FAILURE ;
4950
4952
}
4951
4953
@@ -4966,8 +4968,6 @@ static int accel_finish_startup(void)
4966
4968
SIGG (reset ) = old_reset_signals ;
4967
4969
#endif
4968
4970
4969
- CG (compiler_options ) = orig_compiler_options ;
4970
-
4971
4971
sapi_module .activate = orig_activate ;
4972
4972
sapi_module .deactivate = orig_deactivate ;
4973
4973
sapi_module .register_server_variables = orig_register_server_variables ;
0 commit comments