summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-08-20 18:20:07 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-08-20 18:20:07 +0000
commit2a41a50216fe7a4e7a2197dd4af7bafabbff54be (patch)
tree56f8890e88540f07da4f1324d7e2310675aeacee
parent8405e1741fe4cc7057516a67851a9317dec56e04 (diff)
downloadphp-git-2a41a50216fe7a4e7a2197dd4af7bafabbff54be.tar.gz
Fixed bug #38524 (strptime() does not initialize the internal date storage
structure).
-rw-r--r--NEWS2
-rw-r--r--ext/standard/datetime.c2
-rwxr-xr-xext/standard/tests/time/bug38524.phpt29
3 files changed, 33 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 4151bb9db6..71d7bbbaa6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Sep 2006, PHP 5.2.0
+- Fixed bug #38524 (strptime() does not initialize the internal date storage
+ structure). (Ilia)
17 Aug 2006, PHP 5.2.0RC2
- Increased default memory limit to 16 megabytes to accommodate for a more
diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c
index 5e791f21cf..7e2a5b4434 100644
--- a/ext/standard/datetime.c
+++ b/ext/standard/datetime.c
@@ -101,6 +101,8 @@ PHP_FUNCTION(strptime)
return;
}
+ memset(&parsed_time, 0, sizeof(parsed_time));
+
unparsed_part = strptime(ts, format, &parsed_time);
if (unparsed_part == NULL) {
RETURN_FALSE;
diff --git a/ext/standard/tests/time/bug38524.phpt b/ext/standard/tests/time/bug38524.phpt
new file mode 100755
index 0000000000..4a2abe9cec
--- /dev/null
+++ b/ext/standard/tests/time/bug38524.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Bug #38524 (strptime() does not initialize the internal date storage structure)
+--FILE--
+<?php
+ var_dump(strptime('2006-08-20', '%Y-%m-%d'));
+?>
+===DONE===
+--EXPECT--
+array(9) {
+ ["tm_sec"]=>
+ int(0)
+ ["tm_min"]=>
+ int(0)
+ ["tm_hour"]=>
+ int(0)
+ ["tm_mday"]=>
+ int(20)
+ ["tm_mon"]=>
+ int(7)
+ ["tm_year"]=>
+ int(106)
+ ["tm_wday"]=>
+ int(0)
+ ["tm_yday"]=>
+ int(231)
+ ["unparsed"]=>
+ string(0) ""
+}
+===DONE===