-
Bug
-
Resolution: Fixed
-
Major
-
3.9.18, 3.11.11, 4.0.5, 4.1, 4.2
-
MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE
-
MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
-
MDL-76674_401 -
-
It seems that latest versions of PHP come with a version of IANA database (TZDB) time zones version 2022g that includes a new timezone: America/Ciudad_Juarez.
Source: http://mm.icann.org/pipermail/tz-announce/2022-November.txt
And this is the failure that we are getting when using the latest PHP versions using that time zones database:
$ vendor/bin/phpunit lib/tests/date_test.php
|
Moodle 4.2dev (Build: 20221209)
|
Php: 8.0.26, pgsql: 13.5, OS: Darwin 21.6.0 x86_64
|
PHPUnit 9.5.26 by Sebastian Bergmann and contributors.
|
|
....F............................................................ 65 / 67 ( 97%)
|
.. 67 / 67 (100%)
|
|
Time: 00:01.805, Memory: 42.00 MB
|
|
There was 1 failure:
|
|
1) date_test::test_timezone_lang_strings
|
String for timezone america/ciudad_juarez not found.
|
Failed asserting that false is true.
|
|
~moodle/lib/tests/date_test.php:185
|
~moodle/lib/phpunit/classes/advanced_testcase.php:80
|
~/composerbase/moodle/402/vendor/phpunit/phpunit/phpunit:98
|
|
FAILURES!
|
Tests: 67, Assertions: 2974, Failures: 1.
|
So this issue is about to add that new America/Ciudad_Juarez in all supported versions.
As a reference, MDL-75641 was, in practice, the same case. Trivial to fix, it seems, just add the new string.
Ciao
==== ==== ==== ==== ==== ====
Important note: (see MDL-78151 for more information). Please carry it over future issues like this.
- PHP classes normally uses IANA's timezone database that is updated with the timezonedb PHP extension (available via PECL).
- The Intl classes, that are a wrapper over ICU libraries, use their own timezone information, that is generated using IANA's as source, but different from it.
- Normally you can have actual IANA's timezones but outdated ICU's timezones (from when the PHP binaries were compiled or the ICU libraries imported.
- That makes problems like
MDL-78151to happen, where a timezone that is perfectly valid (because it's in the IANA's timezones but not in the ICU's one). - To workaround that, each time that we add a new timezone to the lang strings we should, also, add a valid mapping within the core_date::strftime() method so, instead of using a timezone that still is not available, uses some pre-existing one, known to work.
Also, if you want to ensure that your system is using updated ICU's timezones, this link may be useful:
Note that some OS bundle both IANA's and ICU's timezone databases within their "tzdata" package (Ubuntu, ...) so the files may be already in the system, but others don't (Debian, ....).
Files for all ICU's timezone databases can be found in the following link, and the ICU_TIMEZONE_FILES_DIR can be used to tell to ICU's libraries where to find them:
Finally, to be sure about the timezone database versions being used in your PHP environments, you can use these commands:
- IANA's (from php-timezonedb extension or from system):
php -r 'var_dump(timezone_version_get());' - ICU's (from php-intl extension or from system):
php -r "var_dump(IntlTimeZone::getTZDataVersion());"
- has a non-specific relationship to
-
MDL-75641 String for timezone europe/kyiv not found (tzdb 2022b)
-
- Closed
-
- has been marked as being related by
-
MDL-78151 The setGregorianChange() error appears on the profile page when the Kyiv time zone is selected.
-
- Closed
-
- has to be done before
-
MDL-76675 Better detection and handling of tzdata changes
-
- Closed
-