fix datetime warning in logger
authorMichael Wallner <mike@php.net>
Mon, 3 Aug 2015 09:18:28 +0000 (11:18 +0200)
committerMichael Wallner <mike@php.net>
Mon, 3 Aug 2015 09:18:28 +0000 (11:18 +0200)
tests/helper/server.inc

index c522c63f473df6a2cdfe1f9662b7d356cd2f2232..6838ac11e8bbeb2d33e77fbfe045c59f02672f68 100644 (file)
@@ -4,6 +4,9 @@ ini_set("log_errors", true);
 ini_set("error_log", __DIR__."/server.log");
 
 function logger() {
+       if (!ini_get("date.timezone")) {
+               date_default_timezone_set(@date_default_timezone_get());
+       }
        error_log(sprintf("%s(%s): %s", 
                basename(getenv("SCRIPT_FILENAME"), ".php"), 
                basename(current(get_included_files()), ".inc"), 
@@ -46,7 +49,7 @@ function serve($cb) {
                                                }
                                                logger("serve: EOF on client %d", (int) $client);
                                        } catch (Exception $ex) {
-                                               logger("serve: Exception on client %d", (int) $client);
+                                               logger("serve: Exception on client %d: %s", (int) $client, $ex->getMessage());
                                                /* ignore disconnect */
                                                if ($ex->getMessage() !== "Empty message received from stream") {
                                                        fprintf(STDERR, "%s\n", $ex);