mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
8426623521
Fixes among others: . Bug #79580 (date_create_from_format misses leap year). . Bug #80974 (Wrong diff between 2 dates in different timezones). . Bug #81097 (DateTimeZone silently falls back to UTC when providing an offset with seconds). . Bug #81273 (Date interval calculation not correct).
40 lines
774 B
PHP
40 lines
774 B
PHP
--TEST--
|
|
Bug #73426 (createFromFormat with 'z' format char results in incorrect time)
|
|
--INI--
|
|
date.timezone=UTC
|
|
--FILE--
|
|
<?php
|
|
$date = '2016 12:00:00 15';
|
|
$format = 'Y H:i:s z';
|
|
var_dump(DateTime::createFromFormat($format, $date));
|
|
|
|
$date = '16 12:00:00 2016';
|
|
$format = 'z H:i:s Y';
|
|
var_dump(DateTime::createFromFormat($format, $date));
|
|
var_dump(DateTime::getLastErrors());
|
|
?>
|
|
--EXPECTF--
|
|
object(DateTime)#1 (3) {
|
|
["date"]=>
|
|
string(26) "2016-01-16 12:00:00.000000"
|
|
["timezone_type"]=>
|
|
int(3)
|
|
["timezone"]=>
|
|
string(3) "UTC"
|
|
}
|
|
bool(false)
|
|
array(4) {
|
|
["warning_count"]=>
|
|
int(0)
|
|
["warnings"]=>
|
|
array(0) {
|
|
}
|
|
["error_count"]=>
|
|
int(1)
|
|
["errors"]=>
|
|
array(1) {
|
|
[0]=>
|
|
string(57) "A 'day of year' can only come after a year has been found"
|
|
}
|
|
}
|