From: sumorai at gmail dot com
Operating system: Mac OS X 10.4.10
PHP version: 5.2.4
PHP Bug Type: Date/time related
Bug description: incorrect parsing in strptime()
Description:
------------
strptime() seems to have two problems. First is that it returns the
month - 1 instead of the correct numerical month value. Second is that
it returns "107" for the year instead of "2007" as it should. I tested
this in the latest CVS snapshot also (php5.2-200709201630). Also, for
years prior to 2000, it returns the two-digit year, e.g. 96 instead of
1996 when using the %Y format code, which is supposed to return the
four-digit year.
Reproduce code:
---------------
<?
$tmp = strptime("20/Sep/2007:11:51:15","%d/%b/%Y:%H:%M:%S");
var_dump($tmp);
?>
Expected result:
----------------
array(9) {
["tm_sec"]=>
int(15)
["tm_min"]=>
int(51)
["tm_hour"]=>
int(11)
["tm_mday"]=>
int(20)
["tm_mon"]=>
int(9)
["tm_year"]=>
int(2007)
["tm_wday"]=>
int(0)
["tm_yday"]=>
int(0)
["unparsed"]=>
string(0) ""
}
Actual result:
--------------
array(9) {
["tm_sec"]=>
int(15)
["tm_min"]=>
int(51)
["tm_hour"]=>
int(11)
["tm_mday"]=>
int(20)
["tm_mon"]=>
int(8)
["tm_year"]=>
int(107)
["tm_wday"]=>
int(0)
["tm_yday"]=>
int(0)
["unparsed"]=>
string(0) ""
}
--
Edit bug report at http://bugs.php.net/?id=42719&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=42719&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=42719&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=42719&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42719&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=42719&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42719&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42719&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42719&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42719&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42719&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=42719&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=42719&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42719&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42719&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42719&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42719&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42719&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42719&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42719&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42719&r=mysqlcfg