From:             php at michaelho dot com
Operating system: Max OS X 10.4.7
PHP version:      5.2.0
PHP Bug Type:     Date/time related
Bug description:  setTime() on a DateTime constructed with a Weekday yields 
incorrect results

Description:
------------
When calling setTime() on a DateTime that has been constructed with a
Weekday (e.g. new DateTime('Wednesday'))...

Calling setTime() causes the date to "jump" to the Next Sunday.  This
happens on each and every call to setTime().

Reproduce code:
---------------
<?php
        $dttTest = new DateTime('Next Wednesday');
        print $dttTest->format('D M j Y - H:i:s') . '<br/>';
        /* Correctly outputs: "Wed Dec 13 2006 - 00:00:00" */

        $dttTest->setTime(12, 0, 0);
        print $dttTest->format('D M j Y - H:i:s') . '<br/>';
        /* EXPECTING: "Wed Dec 13 2006 - 12:00:00" */
        /* ACTUAL: "Sun Dec 17 2006 - 12:00:00" */

        $dttTest->setTime(12, 0, 0);
        print $dttTest->format('D M j Y - H:i:s') . '<br/>';
        /* EXPECTING: "Wed Dec 13 2006 - 12:00:00" */
        /* ACTUAL: "Sun Dec 24 2006 - 12:00:00" */
?>

Expected result:
----------------
Wed Dec 13 2006 - 00:00:00
Wed Dec 13 2006 - 12:00:00
Wed Dec 13 2006 - 12:00:00


Actual result:
--------------
Wed Dec 13 2006 - 00:00:00
Sun Dec 17 2006 - 12:00:00
Sun Dec 24 2006 - 12:00:00

-- 
Edit bug report at http://bugs.php.net/?id=39782&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=39782&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=39782&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=39782&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=39782&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=39782&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=39782&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=39782&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=39782&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=39782&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=39782&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=39782&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=39782&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=39782&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=39782&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=39782&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=39782&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=39782&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=39782&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=39782&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=39782&r=mysqlcfg

Reply via email to