php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: roelharbers at gmail dot com
New email:
PHP Version: OS:

 

 [2016-06-29 10:00 UTC] roelharbers at gmail dot com
Description:
------------
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:
--------------
5.6.22:
2016-06-20T12:00:00+00:00
5.6.23:
2016-06-13T12:00:00+00:00


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-29 11:36 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2016-06-29 11:36 UTC] cmb@php.net
Behavioral change confirmed: <https://3v4l.org/R4T5a>. 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] <https://github.com/php/php-src/commit/f43f6fc3>
[2] <https://github.com/php/php-src/blob/php-5.6.23/NEWS>
[3] <http://php.net/ChangeLog-5.php#5.6.23>
 [2016-06-29 11:36 UTC] cmb@php.net
-Type: Bug +Type: Documentation Problem
 [2016-06-29 11:44 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=339521
Log: Fix #72514: Behaviour of relative date format &quot;this week&quot; has changed
 [2016-06-29 11:47 UTC] cmb@php.net
-Assigned To: cmb +Assigned To: tyrael
 [2016-06-29 11:47 UTC] cmb@php.net
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] tyrael@php.net
for the record the NEWS entry is there, but was added to the wrong php version (5.6.21), while in https://bugs.php.net/bug.php?id=63740 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] cmb@php.net
-Assigned To: tyrael +Assigned To: ab
 [2016-07-03 22:55 UTC] cmb@php.net
Thanks, Ferenc. Antol, can you also please fix the NEWS and the
Changelog of PHP 7.0?
 [2016-07-04 09:12 UTC] ab@php.net
-Status: Verified +Status: Closed
 [2016-07-04 09:12 UTC] ab@php.net
Done. Thanks for the check, Christoph.
 [2020-02-07 06:07 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/en.git;a=commit;h=b362985477fb25ba3de290f9884b2135b8c22928
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: Tue Mar 19 03:01:29 2024 UTC