Bug #72514 [Opn->Ver]: Behaviour of relative date format "this week" has changed
| From: | cmb@php.net | Date: | Wed, 29 Jun 2016 11:36:32 +0000 |
| Subject: | Bug #72514 [Opn->Ver]: Behaviour of relative date format "this week" has changed | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201903@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72514&edit=1
ID: 72514
Updated by: cmb@php.net
Reported by: roelharbers at gmail dot com
Summary: Behaviour of relative date format "this week" has
changed
-Status: Open
+Status: Verified
Type: Bug
Package: Date/time related
Operating System: Ubuntu, OSX
PHP Version: 5.6.23
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
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>
Previous Comments:
------------------------------------------------------------------------
[2016-06-29 10:00:35] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72514&edit=1