From: phil at goli dot at
Operating system: FreeBSD 6.2-RELEASE-p1
PHP version: 4.4.7
PHP Bug Type: Date/time related
Bug description: strtotime("first Sunday" ... does not work in command line
Description:
------------
the problem described occurs only in the version 4.4.7
the script below produces the following output when run as a web-script:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-09
$myThirdAdvent: 12-16
$myFourthAdvent: 12-23
the script below produces the following output when run via command line:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-02
$myThirdAdvent: 12-02
$myFourthAdvent: 12-02
Reproduce code:
---------------
<?php
$myTmp = strtotime("first Sunday", mktime(0, 0, 0, 11, 27, 2007) ); //
date("Y", myDST())
$myFirstAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$mySecondAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$myThirdAdvent = date("m-d", $myTmp);
$myTmp = strtotime("next Sunday", $myTmp);
$myFourthAdvent = date("m-d", $myTmp);
echo '$myFirstAdvent: ' . $myFirstAdvent . "\n";
echo '$mySecondAdvent: ' . $mySecondAdvent . "\n";
echo '$myThirdAdvent: ' . $myThirdAdvent . "\n";
echo '$myFourthAdvent: ' . $myFourthAdvent . "\n";
?>
Expected result:
----------------
if run in the command line it should also the correct dates:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-09
$myThirdAdvent: 12-16
$myFourthAdvent: 12-23
Actual result:
--------------
if run in the command line it displays these dates:
$myFirstAdvent: 12-02
$mySecondAdvent: 12-02
$myThirdAdvent: 12-02
$myFourthAdvent: 12-02
--
Edit bug report at http://bugs.php.net/?id=43472&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43472&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43472&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43472&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43472&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43472&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43472&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43472&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43472&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43472&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43472&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43472&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43472&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43472&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43472&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43472&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43472&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43472&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43472&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43472&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43472&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43472&r=mysqlcfg