Bug #76634 [NEW]: setISODate sets current time(date is correct)

From: Date: Mon, 16 Jul 2018 17:51:53 +0000
Subject: Bug #76634 [NEW]: setISODate sets current time(date is correct)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216355@lists.php.net to get a copy of this message
From: pawlu dot kolo at yahoo dot pl Operating system: Ubuntu 16 PHP version: 7.0.30 Package: Date/time related Bug Type: Bug Bug description:setISODate sets current time(date is correct) Description: ------------ I found out that setISODate function does not set timestamp as expected. It sets proper date but time seems to be taken from current timestamp. I know that it is meant to set date but it should set 00:00:00 for time part to ensure repeatable results. Test script: --------------- $date='2018-06-29 00:00:00'; $startDate=(new DateTime())->setISODate(date('Y',strtotime($date)),date('W',strtotime($date)))->format('Y-m-d H:i:s'); $endDate=(new DateTime())->setISODate(date('Y',strtotime($date)), date('W',strtotime($date)), 7)->format('Y-m-d H:i:s'); $startTimestamp = (new DateTime())->setISODate(date('Y',strtotime($date)),date('W',strtotime($date)))->getTimestamp(); echo 'input = '.$date; echo '<br/>strtotime = '.strtotime($date); echo '<br/>setISODate->getTimestamp = '; echo $startTimestamp; echo '</br>startDate = '.$startDate.'<br/>endDate = '.$endDate; Expected result: ---------------- input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529899200 startDate = 2018-06-25 00:00:00 endDate = 2018-07-01 00:00:00 Actual result: -------------- input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529946301 startDate = 2018-06-25 13:05:01 endDate = 2018-07-01 13:05:01 or bit later: input = 2018-06-29 00:00:00 strtotime = 1530244800 setISODate->getTimestamp = 1529946704 startDate = 2018-06-25 13:11:44 endDate = 2018-07-01 13:11:44 -- Edit bug report at https://bugs.php.net/bug.php?id=76634&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76634&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76634&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76634&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76634&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76634&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76634&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76634&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76634&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76634&r=support Expected behavior: https://bugs.php.net/fix.php?id=76634&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76634&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76634&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76634&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76634&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76634&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76634&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76634&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76634&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76634&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76634&r=mysqlcfg

« previous php.bugs (#216355) next »