]> granicus.if.org Git - php/commitdiff
- Fixed bug #33562 (date("") crashes).
authorDerick Rethans <derick@php.net>
Mon, 4 Jul 2005 07:48:19 +0000 (07:48 +0000)
committerDerick Rethans <derick@php.net>
Mon, 4 Jul 2005 07:48:19 +0000 (07:48 +0000)
NEWS
ext/date/php_date.c
ext/date/tests/bug33562.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 09f10c9b6912065bcc5e81b8e73ca35d817653ea..95e13432b76f87d2d8426c42bd3b4ac3cf39fc1a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP                                                                        NEWS
 - Added date_timezone_set() function to set the timezone that the date
   functions will use. (Derick)
 - Implemented feature request #33452 (Year belonging to ISO week). (Derick)
+- Fixed bug #33562 (date("") crashes). (Derick)
 - Fixed bug #33536 (strtotime() defaults to now even on non time string).
   (Derick)
 - Fixed bug #33532 (Different output for strftime() and date()). (Derick)
index b5a1b66ccf9db395bf7f15e8f622bad01cd92068..eaa7f9c742e972bdb0fc7d559239694d35e2f5f0 100644 (file)
@@ -228,6 +228,7 @@ static char *php_format_date(char *format, int format_len, timelib_time *t, int
                offset = timelib_get_time_zone_info(t->sse, t->tz_info);
        }
        buffer[32] = '\0';
+       smart_str_appends(&string, "");
        timelib_isoweek_from_date(t->y, t->m, t->d, &isoweek, &isoyear);
 
        for (i = 0; i < format_len; i++) {
diff --git a/ext/date/tests/bug33562.phpt b/ext/date/tests/bug33562.phpt
new file mode 100644 (file)
index 0000000..f86fce6
--- /dev/null
@@ -0,0 +1,11 @@
+--TEST--
+Bug #33562 (date("") crashes)
+--FILE--
+<?php
+date_timezone_set("GMT");
+echo "[", date(""), "]\n";
+echo "done";
+?>
+--EXPECT--
+[]
+done