diff options
author | Aaron Bannert <aaron@php.net> | 2002-05-06 15:42:23 +0000 |
---|---|---|
committer | Aaron Bannert <aaron@php.net> | 2002-05-06 15:42:23 +0000 |
commit | 4bbf5a04ed210c9a20c31816643b8dd09a2741df (patch) | |
tree | 9dabf68d7cb04b4168fb8294ccbef802f46caf7b | |
parent | 99a15a90c7b8a0c3a1decf6f6a30eb1ff8e6be65 (diff) | |
download | php-git-4bbf5a04ed210c9a20c31816643b8dd09a2741df.tar.gz |
Merge two SEGV fixes from the trunk:
- startup SEGV caused by delaying the initialization too long.
- graceful restart SEGV caused by not re-initializing.
-rw-r--r-- | sapi/apache2filter/sapi_apache2.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sapi/apache2filter/sapi_apache2.c b/sapi/apache2filter/sapi_apache2.c index 11a2632e2f..fe485d275a 100644 --- a/sapi/apache2filter/sapi_apache2.c +++ b/sapi/apache2filter/sapi_apache2.c @@ -437,6 +437,23 @@ static int php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { + void *data = NULL; + const char *userdata_key = "apache2filter_post_config"; + + /* Apache will load, unload and then reload a DSO module. This + * prevents us from starting PHP until the second load. */ + apr_pool_userdata_get(&data, userdata_key, s->process->pool); + if (data == NULL) { + /* We must use set() here and *not* setn(), otherwise the + * static string pointed to by userdata_key will be mapped + * to a different location when the DSO is reloaded and the + * pointers won't match, causing get() to return NULL when + * we expected it to return non-NULL. */ + apr_pool_userdata_set((const void *)1, userdata_key, + apr_pool_cleanup_null, s->process->pool); + return OK; + } + tsrm_startup(1, 1, 0, NULL); sapi_startup(&apache2_sapi_module); apache2_sapi_module.startup(&apache2_sapi_module); |