php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73551 DateTime with improved microsec BC change not documented in 7.1 migration guide
Submitted: 2016-11-17 07:30 UTC Modified: 2016-11-18 11:11 UTC
From: aa dot vasilenko at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: 7.1.0RC4 OS:
Private report: No CVE-ID: None
 [2016-11-17 07:30 UTC] aa dot vasilenko at gmail dot com
Description:
------------
Fix for #48225 in 7.10RC4 broke tests on our side. Basically now it's not possible to assume that 2 `\new DateTime()` are the same. Of course this is bad behavior but I'm nearly sure that a lot of business logic is using it.

Would be nice to list it as a breaking change in documentation or "What's New" to prepare developers better for upcoming 7.1 release

Test script:
---------------
<?php

$a = new DateTime();

for ($i = 0; $i < 100; $i++) {
  //noop, just to let some microseconds pass
}

$b = new DateTime();

var_dump($a == $b);

Expected result:
----------------
true 

//<7.1RC4

Actual result:
--------------
false

//>=7.1RC4

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-11-17 07:49 UTC] requinix@php.net
-Summary: new DateTime() with microsec is BC +Summary: DateTime with improved microsec BC change not documented in 7.1 migration guide -Package: Documentation problem +Package: Date/time related -PHP Version: 7.1.0RC6 +PHP Version: 7.1.0RC4
 [2016-11-17 07:49 UTC] requinix@php.net
You couldn't assume that anyways: it was unlikely, but still possible that time would change during the few microseconds between new instances, eg. 12:00:00.999999 to 12:00:01.000000.

Note that the microseconds improvements happened with RC4.
https://3v4l.org/E2fdA
https://github.com/php/php-src/commit/55626549d81d0feadb1d160be78fcf2b898a48cc
 [2016-11-17 08:45 UTC] aa dot vasilenko at gmail dot com
You're absolutely right. But still it was working 99.5% of the time :). As I said - it would be great to include it in migration guide, do not "fix" it.
 [2016-11-18 10:51 UTC] cmb@php.net
-Status: Open +Status: Verified -Assigned To: +Assigned To: cmb
 [2016-11-18 11:09 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-11-18 11:09 UTC] cmb@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

Fixed with <http://svn.php.net/viewvc?view=revision&revision=341067>.
 [2016-11-18 11:10 UTC] krakjoe@php.net
-Status: Closed +Status: Verified
 [2016-11-18 11:10 UTC] krakjoe@php.net
I believe there was a note in upgrading.

This seems like a doc issue @cmb ?
 [2016-11-18 11:11 UTC] cmb@php.net
-Status: Verified +Status: Closed
 [2016-11-18 11:11 UTC] cmb@php.net
> This seems like a doc issue @cmb ?

Yes, and I've just fixed it (see above).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 18:01:31 2024 UTC