From 64df92e053cd0a3b19267b737c760de9f87e6661 Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Sun, 5 Mar 2000 21:37:47 +0000 Subject: [PATCH] Fix traps due to sapi_global not being initialized when ZTS is set Don't trap if php.ini can't be read --- main/SAPI.c | 9 ++++++++- main/main.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main/SAPI.c b/main/SAPI.c index e1be74d3a9..50289d5daf 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -57,6 +57,13 @@ SAPI_API int sapi_globals_id; sapi_globals_struct sapi_globals; #endif +#ifdef ZTS +static void sapi_globals_ctor(sapi_globals_struct *sapi_globals) +{ + memset(sapi_globals,0,sizeof(*sapi_globals)); +} + +#endif /* True globals (no need for thread safety) */ sapi_module_struct sapi_module; @@ -71,7 +78,7 @@ SAPI_API void sapi_startup(sapi_module_struct *sf) sapi_register_post_entries(supported_post_entries); #ifdef ZTS - sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), NULL, NULL); + sapi_globals_id = ts_allocate_id(sizeof(sapi_globals_struct), sapi_globals_ctor, NULL); #endif reentrancy_startup(); diff --git a/main/main.c b/main/main.c index 3978987b9f..8a092a1d8e 100644 --- a/main/main.c +++ b/main/main.c @@ -961,7 +961,7 @@ static int php_hash_environment(ELS_D SLS_DC PLS_DC) php_import_environment_variables(ELS_C PLS_CC); } - while(*p) { + while(p && *p) { switch(*p++) { case 'p': case 'P': -- 2.40.0