- Intl:
. Fixed bug #65683 (Intl does not support DateTimeImmutable). (Ben Scholzen)
+ . Fixed bug #74298 (IntlDateFormatter->format() doesn't return
+ microseconds/fractions). (Andrew Nester)
- OpenSSL:
. Fixed bug #74341 (openssl_x509_parse fails to parse ASN.1 UTCTime without
}
if (millis) {
+ php_date_obj *datetime;
+
ZVAL_STRING(&zfuncname, "getTimestamp");
if (call_user_function(NULL, z, &zfuncname, &retval, 0, NULL)
!= SUCCESS || Z_TYPE(retval) != IS_LONG) {
return FAILURE;
}
- *millis = U_MILLIS_PER_SECOND * (double)Z_LVAL(retval);
+ datetime = Z_PHPDATE_P(z);
+ *millis = U_MILLIS_PER_SECOND * ((double)Z_LVAL(retval) + datetime->time->f);
zval_ptr_dtor(&zfuncname);
}
--- /dev/null
+--TEST--
+Bug #74298 (IntlDateFormatter->format() doesn't return microseconds/fractions)
+--SKIPIF--
+<?php if (!extension_loaded('intl')) print 'skip'; ?>
+--FILE--
+<?php
+var_dump((new \DateTime('2017-01-01 01:02:03.123456'))->format('Y-m-d\TH:i:s.u'));
+
+var_dump((new \IntlDateFormatter(
+ 'en-US',
+ \IntlDateFormatter::FULL,
+ \IntlDateFormatter::FULL,
+ 'UTC',
+ \IntlDateFormatter::GREGORIAN,
+ 'yyyy-MM-dd HH:mm:ss.SSSSSS'
+))->format(new \DateTime('2017-01-01 01:02:03.123456')));
+
+var_dump(datefmt_create(
+ 'en-US',
+ \IntlDateFormatter::FULL,
+ \IntlDateFormatter::FULL,
+ 'UTC',
+ \IntlDateFormatter::GREGORIAN,
+ 'yyyy-MM-dd HH:mm:ss.SSSSSS'
+)->format(new \DateTime('2017-01-01 01:02:03.123456')));
+?>
+--EXPECTF--
+string(26) "2017-01-01T01:02:03.123456"
+string(26) "2017-01-01 01:02:03.123000"
+string(26) "2017-01-01 01:02:03.123000"