#46268 [NEW]: When call DateTime#setTime, it seems to be called the last modify method too

From: Date: Fri, 10 Oct 2008 04:27:11 +0000
Subject: #46268 [NEW]: When call DateTime#setTime, it seems to be called the last modify method too
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-129600@lists.php.net to get a copy of this message
From: shimooka at doyouphp dot jp Operating system: CentOS5.2, WindowsXP(SP3) PHP version: 5.3.0alpha2 PHP Bug Type: Date/time related Bug description: When call DateTime#setTime, it seems to be called the last modify method too Description: ------------ When I call DateTime#setTime, it seems to be called the last modify method too. If I use date_time_set function, I get the same result. This report is similar to Bug #41599, but differ from #41599 in using 'time'(01:02:03). With PHP5.2.6, I get the expected result. Reproduce code: --------------- <?php date_default_timezone_set('Asia/Tokyo'); $now = new DateTime('2008-10-10 01:02:03'); echo $now->format("Y-m-d H:i:s") . PHP_EOL; $now->modify("1 day after"); echo $now->format("Y-m-d H:i:s") . PHP_EOL; $now->modify("1 hour after"); echo $now->format("Y-m-d H:i:s") . PHP_EOL; $now->setTime(0, 0, 0); //date_time_set($now, 0, 0, 0); echo $now->format("Y-m-d H:i:s") . PHP_EOL; Expected result: ---------------- 2008-10-10 01:02:03 2008-10-11 01:02:03 2008-10-11 02:02:03 2008-10-11 00:00:00 Actual result: -------------- 2008-10-10 01:02:03 2008-10-11 01:02:03 2008-10-11 02:02:03 2008-10-11 01:00:00 -- Edit bug report at http://bugs.php.net/?id=46268&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46268&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46268&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46268&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46268&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46268&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46268&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46268&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46268&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46268&r=support Expected behavior: http://bugs.php.net/fix.php?id=46268&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46268&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46268&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46268&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46268&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46268&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46268&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46268&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46268&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46268&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46268&r=mysqlcfg

« previous php.bugs (#129600) next »