|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #72514 Behaviour of relative date format "this week" has changed
Submitted: 2016-06-29 10:00 UTC Modified: 2016-07-04 09:12 UTC
From: roelharbers at gmail dot com Assigned: ab (profile)
Status: Closed Package: Date/time related
PHP Version: 5.6.23 OS: Ubuntu, OSX
Private report: No CVE-ID: None
 [2016-06-29 10:00 UTC] roelharbers at gmail dot com
In php v5.6.22, the relative date format "this week" returns the next monday when called on a sunday date.

In php v5.6.23, it returns the previous monday.

It might be that the new behaviour is better, however, I find no mention of this backward compatibility breaking change in the changelog. 

Test script:
for v in 5.6.22 5.6.23; do ( echo $v: ; docker run --rm php:$v php -r 'date_default_timezone_set("UTC");echo (new DateTime("2016-06-19"))->modify("this week")->format("c")."\n";') done

Expected result:
I expect both versions to return the same.

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-29 11:36 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2016-06-29 11:36 UTC]
Behavioral change confirmed: <>. Apparently,
`this week` is a shortcut for `Monday this week`, and the date
extension assumes monday to be the first day of the week.

Thus, the behavior before PHP 5.6.23 has to be regarded as a bug,
what has been reported as bug #63740, and recently been fixed[1].
Even though this commit added a NEWS entry, this did neither make
it into the PHP 5.6.23 NEWS[2] nor the Changelog[3] nor to the
NEWS/Changelog of later versions.

[1] <>
[2] <>
[3] <>
 [2016-06-29 11:36 UTC]
-Type: Bug +Type: Documentation Problem
 [2016-06-29 11:44 UTC]
Automatic comment from SVN on behalf of cmb
Log: Fix #72514: Behaviour of relative date format &quot;this week&quot; has changed
 [2016-06-29 11:47 UTC]
-Assigned To: cmb +Assigned To: tyrael
 [2016-06-29 11:47 UTC]
I've added a changelog entry to the "Relative Formats" section.
Ferenc, can you please add the missing NEWS and Changelog entries?
 [2016-07-03 22:44 UTC]
for the record the NEWS entry is there, but was added to the wrong php version (5.6.21), while in it was communicated as it will present in 5.6.22 (which did not happen as the commit was made after 5.6.22RC1 was tagged) while actually it was released in 5.6.23.
I've updated the NEWS in PHP-5.6 and the Changelog.
 [2016-07-03 22:55 UTC]
-Assigned To: tyrael +Assigned To: ab
 [2016-07-03 22:55 UTC]
Thanks, Ferenc. Antol, can you also please fix the NEWS and the
Changelog of PHP 7.0?
 [2016-07-04 09:12 UTC]
-Status: Verified +Status: Closed
 [2016-07-04 09:12 UTC]
Done. Thanks for the check, Christoph.
 [2020-02-07 06:07 UTC]
Automatic comment on behalf of cmb
Log: Fix #72514: Behaviour of relative date format &quot;this week&quot; has changed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC