php-src/ext/date/tests/bug73426.phpt
Derick Rethans 8426623521 Upgrade timelib to 2021.06
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).
2021-08-08 13:41:33 +01:00

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"
}
}