ID:               43472
 Comment by:       danmagicman7 at gmail dot com
 Reported By:      phil at goli dot at
 Status:           Open
 Bug Type:         Date/time related
 Operating System: FreeBSD 6.2-RELEASE-p1
 PHP Version:      4.4.7
 New Comment:

The problem is with "next Sunday".  It will not advance to the next
Sunday. I ran into this problem as well.


Previous Comments:
------------------------------------------------------------------------

[2007-12-01 17:07:25] phil at goli dot at

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 this bug report at http://bugs.php.net/?id=43472&edit=1

Reply via email to