]> granicus.if.org Git - php/commitdiff
- Fixed bug #48247 (Infinite loop and possible crash during startup with errors)
authorJani Taskinen <jani@php.net>
Tue, 7 Jul 2009 16:40:21 +0000 (16:40 +0000)
committerJani Taskinen <jani@php.net>
Tue, 7 Jul 2009 16:40:21 +0000 (16:40 +0000)
main/main.c

index 4fa6dabfdd321f657e009da7d0933ba2c9edafa6..f47a087fb20501dd427f25acbcc878ae7aba3297 100644 (file)
@@ -608,6 +608,20 @@ static int module_initialized = 0;
 static int module_startup = 1;
 static int module_shutdown = 0;
 
+/* {{{ php_during_module_startup */
+static int php_during_module_startup(void)
+{
+       return module_startup;
+}
+/* }}} */
+
+/* {{{ php_during_module_shutdown */
+static int php_during_module_shutdown(void)
+{
+       return module_shutdown;
+}
+/* }}} */
+
 /* {{{ php_log_err
  */
 PHPAPI void php_log_err(char *log_message TSRMLS_DC)
@@ -630,7 +644,7 @@ PHPAPI void php_log_err(char *log_message TSRMLS_DC)
                        char *error_time_str;
 
                        time(&error_time);
-                       error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, 1 TSRMLS_CC);
+                       error_time_str = php_format_date("d-M-Y H:i:s", 11, error_time, php_during_module_startup() TSRMLS_CC);
                        len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str, log_message, PHP_EOL);
 #ifdef PHP_WIN32
                        php_flock(fd, 2);
@@ -679,24 +693,6 @@ PHPAPI int php_printf(const char *format, ...)
 }
 /* }}} */
 
-/* {{{ php_verror helpers */
-
-/* {{{ php_during_module_startup */
-static int php_during_module_startup(void)
-{
-       return module_startup;
-}
-/* }}} */
-
-/* {{{ php_during_module_shutdown */
-static int php_during_module_shutdown(void)
-{
-       return module_shutdown;
-}
-/* }}} */
-
-/* }}} */
-
 /* {{{ php_verror */
 /* php_verror is called from php_error_docref<n> functions.
  * Its purpose is to unify error messages and automatically generate clickable