and also checking if there is a server_context before trying to call
the request_time sapi hook.
SAPI_API time_t sapi_get_request_time(TSRMLS_D)
{
- if (sapi_module.get_request_time) {
- return sapi_module.get_request_time(TSRMLS_C);
+ if(SG(global_request_time)) return SG(global_request_time);
+
+ if (sapi_module.get_request_time && SG(server_context)) {
+ SG(global_request_time) = sapi_module.get_request_time(TSRMLS_C);
} else {
- if(!SG(global_request_time)) SG(global_request_time) = time(0);
- return SG(global_request_time);
+ SG(global_request_time) = time(0);
}
+ return SG(global_request_time);
}
/*