|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-20 18:27 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 08:00:01 2025 UTC |
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] => )