mirror of
https://github.com/php/php-src.git
synced 2024-12-04 23:34:25 +08:00
76 lines
1.7 KiB
PHP
76 lines
1.7 KiB
PHP
--TEST--
|
|
Bug #51393 (DateTime::createFromFormat() fails if format string contains timezone)
|
|
--INI--
|
|
date.timezone=UTC
|
|
--FILE--
|
|
<?php
|
|
$dt = DateTime::createFromFormat('O', '+0800');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('P', '+08:00');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('O', '-0800');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('P', '-08:00');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[O]', '[+0800]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[P]', '[+08:00]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[O]', '[-0800]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[P]', '[-08:00]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('O', 'GMT+0800');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('P', 'GMT+08:00');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('O', 'GMT-0800');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('P', 'GMT-08:00');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[O]', '[GMT+0800]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[P]', '[GMT+08:00]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[O]', '[GMT-0800]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('[P]', '[GMT-08:00]');
|
|
var_dump($dt->getOffset());
|
|
|
|
$dt = DateTime::createFromFormat('O', 'invalid');
|
|
var_dump($dt);
|
|
?>
|
|
--EXPECT--
|
|
int(28800)
|
|
int(28800)
|
|
int(-28800)
|
|
int(-28800)
|
|
int(28800)
|
|
int(28800)
|
|
int(-28800)
|
|
int(-28800)
|
|
int(28800)
|
|
int(28800)
|
|
int(-28800)
|
|
int(-28800)
|
|
int(28800)
|
|
int(28800)
|
|
int(-28800)
|
|
int(-28800)
|
|
bool(false)
|