User tests: Successful: Unsuccessful:
In 3.7 JDate will override DateTime default behaviour to set the microseconds to current time (see #11890)
It seems that, as of php 7.1, the new DateTime() will do the same, ie, set the microseconds when creating a date with the current time.
DateTime and DateTimeImmutable now properly incorporate microseconds when constructed from the current time, either explicitly or with a relative string (e.g. "first day of next month"). This means that naive comparisons of two newly created instances will now more likely return FALSE instead of TRUE:
Source http://php.net/manual/en/migration71.incompatible.php#migration71.incompatible.datetime-microseconds
So probably is best to have a php version check here for pre-7.1 versions to not override php 7.1+ behaviour.
This is what this PR proposes.
$date1 = new JDate('now'); usleep(1000); $date2 = new JDate('now');
JFactory::getApplication()->enqueueMessage($date1->format('Y-m-d H:i:s.u') . '<br />' . $date2->format('Y-m-d H:i:s.u'), 'notice');
Note: don't have php 7.1 to test, if anyone can test if in php 7.1 is all ok
None.
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Title |
|
Title |
|
I have tested this item
Code review + tests on hhvm 3.15.3, php7.0.8, php7.1
Status | Pending | ⇒ | Ready to Commit |
RTC
Milestone |
Added: |
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-12-11 20:27:25 |
Closed_By | ⇒ | rdeutz | |
Labels |
Added:
?
|
I have tested this item✅ successfully on 1dc5545
Tested with and without patch on PHP 5.6.27, 7.0.13 and 7.1. 1100-1300 microsecond difference in all cases.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13079.