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

From: Date: Fri, 10 Feb 2017 14:48:36 +0000
Subject: Bug #74057 [Asn]: wrong day when using "this week" in strtotime
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207253@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74057&edit=1 ID: 74057 Updated by: derick@php.net Reported by: tony at brix dot ninja Summary: wrong day when using "this week" in strtotime Status: Assigned Type: Bug Package: Date/time related Operating System: Windows 10 PHP Version: 5.6.30 Assigned To: derick Block user comment: N Private report: N New Comment: I have a patch, but collecting a few more before I push out a new version of timelib to merge into PHP. Previous Comments: ------------------------------------------------------------------------ [2017-02-07 15:52:58] tony at brix dot ninja 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 this bug report at https://bugs.php.net/bug.php?id=74057&edit=1

« previous php.bugs (#207253) next »