From: srisamir at gmail dot com
Operating system: Windows 2003
PHP version: 4.4.6
PHP Bug Type: Date/time related
Bug description: strftime failed on 2nd April 2007
Description:
------------
I tried the smarty function format_date to format a
date-time(yyyymmddhhmmss).
It was working till last Saturday. Today, Monday when I tried the same, it
was showing wrong date(like 16 Jul, 98 00:00:00).
But when I changed the system date(say, 1st April or 3rd April) the output
date string was correct.
I went inside the smarty function and try to reproduce the result.
I used the function strftime to format the date-time and got the same
error (wrong display for 2nd April, 2007).
I tried with other dates (say 20070403181644) and got correct display.
Reproduce code:
---------------
error_reporting(E_ALL);
$string = "20070402181644"; //"20070403181644"
$time = strtotime($string);
if (is_numeric($time) && $time != -1) {}
else {
$time = mktime(substr($string,8,2),substr($string,10,2),substr
($string,12,2), substr($string,4,2),
substr ($string,6,2),substr($string,0,4));
}
echo strftime("%d,%b,%Y", $time);
Expected result:
----------------
02,Apr,2007
Actual result:
--------------
08,Mar,2006
--
Edit bug report at http://bugs.php.net/?id=40977&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40977&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40977&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40977&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40977&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40977&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40977&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40977&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40977&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40977&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40977&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40977&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40977&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40977&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40977&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40977&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40977&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40977&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40977&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40977&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40977&r=mysqlcfg