Bug #74057 [NEW]: wrong day when using "this week" in strtotime

From: Date: Tue, 07 Feb 2017 15:52:59 +0000
Subject: Bug #74057 [NEW]: wrong day when using "this week" in strtotime
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207213@lists.php.net to get a copy of this message
From: tony at brix dot ninja Operating system: Windows 10 PHP version: 5.6.30 Package: Date/time related Bug Type: Bug Bug description:wrong day when using "this week" in strtotime Description: ------------ strtotime gives inconsistent results when using "this week" due to the commit at https://git.php.net/?p=php-src.git;a=blobdiff;f=ext/date/lib/tm2unixtime.c;h=57e0cef1be61956874402c02799ea25a8da0d60c;hp=414cf1308200dd066c7e7d8212d6d6591de38ac0;hb=f43f6fc39b92796aa934d4ae13675bb144d23435;hpb=0815f7f755a6248b4b28163e09cbc1c91b15664b Test script: --------------- echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-01")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-02")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Tue 2017-01-03")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Wed 2017-01-04")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Thu 2017-01-05")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Fri 2017-01-06")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sat 2017-01-07")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Sun 2017-01-08")))."\n"; echo date("D Y-m-d", strtotime("saturday this week", strtotime("Mon 2017-01-09")))."\n"; Expected result: ---------------- Sat 2016-12-31 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-14 Actual result: -------------- Mon 2016-12-26 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Sat 2017-01-07 Mon 2017-01-02 Sat 2017-01-14 -- Edit bug report at https://bugs.php.net/bug.php?id=74057&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74057&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74057&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74057&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74057&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74057&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74057&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74057&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74057&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74057&r=support Expected behavior: https://bugs.php.net/fix.php?id=74057&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74057&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74057&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74057&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74057&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74057&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74057&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74057&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74057&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74057&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74057&r=mysqlcfg

« previous php.bugs (#207213) next »