php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75119 function timezone_identifiers_list returns Asia/Rangoon but not Asia/Yangon
Submitted: 2017-08-25 08:36 UTC Modified: 2017-08-25 09:00 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: michele dot carino84 at gmail dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS: Ubuntu 16.10
Private report: No CVE-ID: None
 [2017-08-25 08:36 UTC] michele dot carino84 at gmail dot com
Description:
------------
According to IANA Asia/Rangoon is only a link for Asia/Yangon.
The function timezone_identifiers_list returns only Asia/Rangoon.

The documentation of the function does not specifies that it's going to return only some of the available ids so the user expectation is to have at least main ids, instead of secondary linked ones.

A documentation change would make easy to understand what the function returns.
And also all of the primary ids should be returned.

Test script:
---------------
<?php

if (!in_array('Asia\Yangon', timezone_identifiers_list())) {
    echo 'Asia\Yangon not returned';
}

if (!in_array('Asia\Rangoon', timezone_identifiers_list())) {
    echo PHP_EOL . 'Asia\Rangoon returned';
}



Expected result:
----------------
# if the intent of the function is to return only IANA primary ids

Asia\Yangon returned
Asia\Rangoon not returned 

# else if the intent of the function is to return all of the ids


Asia\Yangon returned
Asia\Rangoon returned 


Actual result:
--------------
Asia\Yangon not returned
Asia\Rangoon returned 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-25 08:41 UTC] michele dot carino84 at gmail dot com
Test script should be

<?php

if (in_array('Asia\Yangon', timezone_identifiers_list())) {
    echo 'Asia\Yangon returned';
} else {
    echo 'Asia\Yangon not returned';
}

if (in_array('Asia\Rangoon', timezone_identifiers_list())) {
    echo PHP_EOL . 'Asia\Rangoon returned';
} else {
    echo PHP_EOL . 'Asia\Rangoon not returned';
}

-----------------------
Sorry
 [2017-08-25 08:43 UTC] michele dot carino84 at gmail dot com
Sorry again, some errors in test script written two times with errors, definitively should be:

<?php

if (in_array('Asia/Yangon', timezone_identifiers_list())) {
    echo 'Asia/Yangon returned';
} else {
    echo 'Asia/Yangon not returned';
}

if (in_array('Asia/Rangoon', timezone_identifiers_list())) {
    echo PHP_EOL . 'Asia/Rangoon returned';
} else {
    echo PHP_EOL . 'Asia/Rangoon not returned';
}
 [2017-08-25 09:00 UTC] michele dot carino84 at gmail dot com
-Status: Open +Status: Closed -Operating System: Any +Operating System: Ubuntu 16.10
 [2017-08-25 09:00 UTC] michele dot carino84 at gmail dot com
I'm going to close this bug, because it is an OS problem, but, what happen if I deploy code on another machine with another list of tz ids?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 05:01:29 2024 UTC