If CGI TS build is used, and there are some hard errors (fe missing
dependency .dll or .so), the core will want to log it. The CGI
log function will want to check whether fcgi_logging is enabled. But,
if this kind of error happens in the extension register phase,
MINIT for the CGI module is most likely wasn't run yet (startup phase).
That will result in accessing uninitialized globals and a crash.
*/
static PHP_MINIT_FUNCTION(cgi)
{
-#ifdef ZTS
- ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
-#else
- php_cgi_globals_ctor(&php_cgi_globals);
-#endif
REGISTER_INI_ENTRIES();
return SUCCESS;
}
ZEND_TSRMLS_CACHE_UPDATE();
#endif
+#ifdef ZTS
+ ts_allocate_id(&php_cgi_globals_id, sizeof(php_cgi_globals_struct), (ts_allocate_ctor) php_cgi_globals_ctor, NULL);
+#else
+ php_cgi_globals_ctor(&php_cgi_globals);
+#endif
+
sapi_startup(&cgi_sapi_module);
fastcgi = fcgi_is_fastcgi();
cgi_sapi_module.php_ini_path_override = NULL;