void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap);
ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len);
+ZEND_API int (*zend_post_startup_cb)(void) = NULL;
void (*zend_on_timeout)(int seconds);
/* Unlink the global (r/o) copies of the class, function and constant tables,
* and use a fresh r/w copy for the startup thread
*/
-void zend_post_startup(void) /* {{{ */
+int zend_post_startup(void) /* {{{ */
{
#ifdef ZTS
zend_encoding **script_encoding_list;
global_persistent_list = &EG(persistent_list);
zend_copy_ini_directives();
#endif
+
+ if (zend_post_startup_cb) {
+ int (*cb)(void) = zend_post_startup_cb;
+
+ zend_post_startup_cb = NULL;
+ if (cb() != SUCCESS) {
+ return FAILURE;
+ }
+ }
+
+ return SUCCESS;
}
/* }}} */
int zend_startup(zend_utility_functions *utility_functions, char **extensions);
void zend_shutdown(void);
void zend_register_standard_ini_entries(void);
-void zend_post_startup(void);
+int zend_post_startup(void);
void zend_set_utility_values(zend_utility_values *utility_values);
ZEND_API ZEND_COLD void _zend_bailout(const char *filename, uint32_t lineno);
extern void (*zend_printf_to_smart_str)(smart_str *buf, const char *format, va_list ap);
extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, size_t filename_len);
+extern ZEND_API int (*zend_post_startup_cb)(void);
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
static zend_string *(*accelerator_orig_zend_resolve_path)(const char *filename, size_t filename_len);
static zif_handler orig_chdir = NULL;
static ZEND_INI_MH((*orig_include_path_on_modify)) = NULL;
+static int (*orig_post_startup_cb)(void);
static void accel_gen_system_id(void);
+static int accel_post_startup(void);
#ifdef ZEND_WIN32
# define INCREMENT(v) InterlockedIncrement64(&ZCSG(v))
return;
}
- if (!ZCG(function_table).nTableSize) {
- zend_hash_init(&ZCG(function_table), zend_hash_num_elements(CG(function_table)), NULL, ZEND_FUNCTION_DTOR, 1);
- zend_accel_copy_internal_functions();
- }
-
/* PHP-5.4 and above return "double", but we use 1 sec precision */
ZCG(auto_globals_mask) = 0;
ZCG(request_time) = (time_t)sapi_get_request_time();
static int accel_startup(zend_extension *extension)
{
- zend_function *func;
- zend_ini_entry *ini_entry;
-
#ifdef ZTS
accel_globals_id = ts_allocate_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor);
#else
return SUCCESS ;
}
+ orig_post_startup_cb = zend_post_startup_cb;
+ zend_post_startup_cb = accel_post_startup;
+
+ return SUCCESS;
+}
+
+static int accel_post_startup(void)
+{
+ zend_function *func;
+ zend_ini_entry *ini_entry;
+
+ if (orig_post_startup_cb) {
+ int (*cb)(void) = orig_post_startup_cb;
+
+ orig_post_startup_cb = NULL;
+ if (cb() != SUCCESS) {
+ return FAILURE;
+ }
+ }
+
+ zend_hash_init(&ZCG(function_table), zend_hash_num_elements(CG(function_table)), NULL, ZEND_FUNCTION_DTOR, 1);
+ zend_accel_copy_internal_functions();
+
/********************************************/
/* End of non-SHM dependent initializations */
/********************************************/
module->info_func = PHP_MINFO(php_core);
}
- zend_post_startup();
+ if (zend_post_startup() != SUCCESS) {
+ return FAILURE;
+ }
module_initialized = 1;