#38524 [Opn->Csd]: strptime returns random values for unparsed parts
| From: | iliaa@php.net | Date: | Sun, 20 Aug 2006 18:27:45 +0000 |
| Subject: | #38524 [Opn->Csd]: strptime returns random values for unparsed parts | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-100998@lists.php.net to get a copy of this message | ||
ID: 38524
Updated by: iliaa@php.net
Reported By: php at felixdd dot de
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: Linux
PHP Version: 5.1.5
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-08-20 16:54:34] php at felixdd dot de
Description:
------------
strptime returns random values for parts not included in the format
string.
manpage of strptime says:
"In principle, this function does not initialize tm but only stores
the values specified. This means that tm should be initialized before
the call."
But this isn't done in ext/standard/datetime.c
neither in 5.1.5 nor in 5.2.0RC2
Reproduce code:
---------------
// only date, no time given
print_r(strptime('2006-08-20', '%Y-%m-%d'));
Expected result:
----------------
Array
(
[tm_sec] => 0
[tm_min] => 0
[tm_hour] => 0
[tm_mday] => 20
[tm_mon] => 7
[tm_year] => 106
[tm_wday] => 0
[tm_yday] => 231
[unparsed] =>
)
Actual result:
--------------
Array
(
[tm_sec] => 140252532 <-- random values each time called
[tm_min] => 13 <-- random values each time called
[tm_hour] => 1 <-- random values each time called
[tm_mday] => 20
[tm_mon] => 7
[tm_year] => 106
[tm_wday] => 0
[tm_yday] => 231
[unparsed] =>
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=38524&edit=1