Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timezone ID '+00:00' resulting in abnormal php notice #52

Open
ohartl opened this issue Oct 24, 2019 · 0 comments
Open

Timezone ID '+00:00' resulting in abnormal php notice #52

ohartl opened this issue Oct 24, 2019 · 0 comments

Comments

@ohartl
Copy link

ohartl commented Oct 24, 2019

When passing a Timezone of '+00:00' (which is valid in normal PHP), while using timecop, it throws an abnormal php notice. This can lead to an exit of the programm depending on your error_reporting setting.

--TEST--
Check timezone '+00:00' being allowed
--SKIPIF--
<?php
$required_func = array("timecop_freeze");
include(__DIR__."/tests-skipcheck.inc.php");
--INI--
date.timezone=America/Los_Angeles
timecop.func_override=1
--FILE--
<?php
$dt1 = new \DateTime('@0', new \DateTimeZone('+00:00'));
var_dump($dt1->format("Y-m-d H:i:s.uP"));

timecop_freeze(0);
$dt2 = new \DateTime('@0', new \DateTimeZone('+00:00'));
var_dump($dt2->format("Y-m-d H:i:s.uP"));
--EXPECT--
string(32) "1970-01-01 00:00:00.000000+00:00"
string(32) "1970-01-01 00:00:00.000000+00:00"

Output of the test:

========OUT========
string(32) "1970-01-01 00:00:00.000000+00:00"

Notice: date_default_timezone_set(): Timezone ID '+00:00' is invalid in ... on line 6
string(32) "1970-01-01 00:00:00.000000+00:00"
========DONE========

========EXP========
string(32) "1970-01-01 00:00:00.000000+00:00"
string(32) "1970-01-01 00:00:00.000000+00:00"
========DONE========

========DIFF========
002+
003+ Notice: date_default_timezone_set(): Timezone ID '+00:00' is invalid in ... on line 6
========DONE========
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant