Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

faker generates unsupported timezones #1010

Closed
rijan0101 opened this issue Sep 1, 2016 · 6 comments
Closed

faker generates unsupported timezones #1010

rijan0101 opened this issue Sep 1, 2016 · 6 comments

Comments

@rijan0101
Copy link

faker generates unsupported timezones

@fzaninotto
Copy link
Owner

Can you be more specific? Which timezone did it generate that doesn't exist?

@CyrilMazur
Copy link

I have the same issue, these two timezones returned by Faker make IntlDateFormatter() crash: Europe/Ulyanovsk and America/Fort_Nelson. There's maybe more, I haven't checked them all.

@CyrilMazur
Copy link

Additional info. I noticed some timezones made IntlDateFormatter() crash on my laptop but not in my CI instance. I think what matters is the ICU Data version, which depends on what system you're using. Debian 7 and 8 provide pretty old versions of the ICU data for instance. One solution would be to decrease Faker's list of timezones to just the "safe" ones, ie those who are present in ICU for quite a long time.

@curry684
Copy link
Contributor

those who are present in ICU for quite a long time

It's not exactly a list with daily changes, and taking an old copy is just as likely to trigger results that were renamed or dropped since then as a new list has the other way around.

However the issue makes no sense, as the timezone generator was implemented 5 years ago and works directly on PHP's internal list of supported timezones. There is simply no way it can generate an invalid timezone, unless you're using it in communication with other tooling than PHP itself, which is outside the scope and responsibility of Faker.

@shadowhand
Copy link

shadowhand commented Nov 22, 2017

Same problem here... generating a random list of timezones with faker, and then dumping it, we can end up with this:

php > print_r($randomElements($tzs, 1)[0]);
Array
(
    [0] => Array
        (
            [dst] =>
            [offset] => -39600
            [timezone_id] =>
        )

)

@fzaninotto
Copy link
Owner

I'm afraid this is a PHP bug, since Faker relies on \DateTimeZone::listIdentifiers() to get a list of valid timezones. Please open an issue in the PHP bug tracker instead.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants