@@ -4451,13 +4451,14 @@ static int preload_autoload(zend_string *filename)
44514451 return ret ;
44524452}
44534453
4454- static int accel_preload (const char * config )
4454+ static int accel_preload (const char * config , zend_bool in_child )
44554455{
44564456 zend_file_handle file_handle ;
44574457 int ret ;
44584458 char * orig_open_basedir ;
44594459 size_t orig_map_ptr_last ;
44604460 zval * zv ;
4461+ uint32_t orig_compiler_options ;
44614462
44624463 ZCG (enabled ) = 0 ;
44634464 ZCG (accelerator_enabled ) = 0 ;
@@ -4474,6 +4475,17 @@ static int accel_preload(const char *config)
44744475 preload_scripts = emalloc (sizeof (HashTable ));
44754476 zend_hash_init (preload_scripts , 0 , NULL , NULL , 0 );
44764477
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+
44774489 zend_try {
44784490 zend_op_array * op_array ;
44794491
@@ -4512,6 +4524,7 @@ static int accel_preload(const char *config)
45124524 } zend_end_try ();
45134525
45144526 PG (open_basedir ) = orig_open_basedir ;
4527+ CG (compiler_options ) = orig_compiler_options ;
45154528 accelerator_orig_compile_file = preload_orig_compile_file ;
45164529 ZCG (enabled ) = 1 ;
45174530
@@ -4809,7 +4822,6 @@ static int accel_finish_startup(void)
48094822 char * (* orig_getenv )(const char * name , size_t name_len ) = sapi_module .getenv ;
48104823 size_t (* orig_ub_write )(const char * str , size_t str_length ) = sapi_module .ub_write ;
48114824 void (* orig_flush )(void * server_context ) = sapi_module .flush ;
4812- uint32_t orig_compiler_options = CG (compiler_options );
48134825#ifdef ZEND_SIGNALS
48144826 zend_bool old_reset_signals = SIGG (reset );
48154827#endif
@@ -4903,16 +4915,6 @@ static int accel_finish_startup(void)
49034915 sapi_module .ub_write = preload_ub_write ;
49044916 sapi_module .flush = preload_flush ;
49054917
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-
49164918 zend_interned_strings_switch_storage (1 );
49174919
49184920#ifdef ZEND_SIGNALS
@@ -4945,7 +4947,7 @@ static int accel_finish_startup(void)
49454947 ZCG (cwd_key_len ) = 0 ;
49464948 ZCG (cwd_check ) = 1 ;
49474949
4948- if (accel_preload (ZCG (accel_directives ).preload ) != SUCCESS ) {
4950+ if (accel_preload (ZCG (accel_directives ).preload , in_child ) != SUCCESS ) {
49494951 ret = FAILURE ;
49504952 }
49514953
@@ -4966,8 +4968,6 @@ static int accel_finish_startup(void)
49664968 SIGG (reset ) = old_reset_signals ;
49674969#endif
49684970
4969- CG (compiler_options ) = orig_compiler_options ;
4970-
49714971 sapi_module .activate = orig_activate ;
49724972 sapi_module .deactivate = orig_deactivate ;
49734973 sapi_module .register_server_variables = orig_register_server_variables ;
0 commit comments