summaryrefslogtreecommitdiff
path: root/ext/standard/datetime.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/standard/datetime.c')
-rw-r--r--ext/standard/datetime.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 592e5a3523..123d080ff5 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -58,6 +58,12 @@ PHPAPI char *php_std_date(time_t t TSRMLS_DC)
tm1 = php_gmtime_r(&t, &tmbuf);
str = emalloc(81);
+ str[0] = '\0';
+
+ if (!tm1) {
+ return str;
+ }
+
if (PG(y2k_compliance)) {
snprintf(str, 80, "%s, %02d %s %04d %02d:%02d:%02d GMT",
day_short_names[tm1->tm_wday],