Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-76674

String for timezone america/ciudad_juarez not found (tzdb 2022g)

XMLWordPrintable

    • 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
    • Hide

      Avoid using the 2022g/2022.7 TZ database or downgrade to older one.

      Show
      Avoid using the 2022g/2022.7 TZ database or downgrade to older one.
    • Hide

      Any (one) of these verifications should be enough:

      [OR] Testing locally.

      1. Requirements:
        1. Ensure you've the latest time zones database installed, version 2022g (apt-get update && apt-get install tzdata) (or other similar commands for other systems).
        2. You can get the latest version installing the timezonedb php extension too (pecl upgrade timezonedb). And then, verify that the installed version is at very least 2022g (also known as 2022.7) using php --re timezonedb.
      2. Init phpunit (php admin/tool/phpunit/cli/init.php).
      3. Run vendor/bin/phpunit lib/tests/date_test.php
      4. Verify that it passes without any failure.

      [OR] Trust GHA runs, that are already using actual versions.

      1. Look to the Github badges in this issue (near the branches information above).
      2. Verify that all them have passed ok (green).
      Show
      Any (one) of these verifications should be enough: [OR] Testing locally. Requirements: Ensure you've the latest time zones database installed, version 2022g ( apt-get update && apt-get install tzdata ) (or other similar commands for other systems). You can get the latest version installing the timezonedb php extension too ( pecl upgrade timezonedb ). And then, verify that the installed version is at very least 2022g (also known as 2022.7) using php --re timezonedb . Init phpunit ( php admin/tool/phpunit/cli/init.php ). Run vendor/bin/phpunit lib/tests/date_test.php Verify that it passes without any failure. [OR] Trust GHA runs, that are already using actual versions. Look to the Github badges in this issue (near the branches information above). Verify that all them have passed ok (green).

      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.

      1. PHP classes normally uses IANA's timezone database that is updated with the timezonedb PHP extension (available via PECL).
      2. 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.
      3. 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.
      4. That makes problems like MDL-78151 to happen, where a timezone that is perfectly valid (because it's in the IANA's timezones but not in the ICU's one).
      5. 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());"

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Paul Holden Paul Holden
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 55 minutes
                55m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.