From: php at felixdd dot de Operating system: Linux PHP version: 5.1.5 PHP Bug Type: Date/time related Bug description: strptime returns random values for unparsed parts
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 bug report at http://bugs.php.net/?id=38524&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38524&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38524&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38524&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=38524&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=38524&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=38524&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=38524&r=needscript Try newer version: http://bugs.php.net/fix.php?id=38524&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=38524&r=support Expected behavior: http://bugs.php.net/fix.php?id=38524&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=38524&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=38524&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=38524&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38524&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=38524&r=dst IIS Stability: http://bugs.php.net/fix.php?id=38524&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=38524&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=38524&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=38524&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=38524&r=mysqlcfg