From: ctrlaltca at libero dot it
Operating system: Slackware Linux
PHP version: 5.2.1
PHP Bug Type: Date/time related
Bug description: date() lose Sundays
Description:
------------
It seems that the date() function "jumps over" sundays when converting
timestamps not referring to midnight.
Similar to #461
Reproduce code:
---------------
<?php
$day=date("j");
$mo=date("n");
$year=date("Y");
for($i=6; $i>=0; $i--)
{
$a=mktime(0, 0, 0, $mo,$day, $year);
$b=date("r",$a);
$c=strtotime($b. "-" . $i . " day");
$curdate=date("Ymd",$c);
$d=date("r");
$e=strtotime($d. "-" . $i . " day");
$curdate2=date("Ymd",$e);
echo
"\n|".$b."=".$d."|".$c."=".$e."|".$curdate."=".$curdate2."|";
}
?>
Expected result:
----------------
I expect this script to return the right "Ymd" dates of the last seven
days.
Actual result:
--------------
It works:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1175032800=1175094817|20070328!=20070328|
but when it finds a sunday, dates are shifted off of 1 day:
|Wed, 28 Mar 2007 00:00:00 +0200=Wed, 28 Mar 2007 17:13:37
+0200|1174773600=1174835617|20070324!=20070325|
--
Edit bug report at http://bugs.php.net/?id=40937&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=40937&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=40937&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=40937&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=40937&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=40937&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=40937&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=40937&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=40937&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=40937&r=support
Expected behavior: http://bugs.php.net/fix.php?id=40937&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=40937&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=40937&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=40937&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40937&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=40937&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=40937&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=40937&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=40937&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=40937&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=40937&r=mysqlcfg