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

String for timezone europe/kyiv not found (tzdb 2022b)

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE
    • Hide

      Avoid using PHP 8.0.23 or PHP 8.1.10 (any PHP release after September 1st, 2022). Or avoid updating the timezones database in the system to 2022b or later if your PHP uses it.

      Show
      Avoid using PHP 8.0.23 or PHP 8.1.10 (any PHP release after September 1st, 2022). Or avoid updating the timezones database in the system to 2022b or later if your PHP uses it.
    • Hide

      Any (one) of these verifications should be enough:

      [OR] Testing locally.

      1. Requirements:
        1. Ensure that you are using PHP 8.0.23 (php -v), install it if needed.
        2. Also,ensure you've the latest time zones database, version 2022b (apt-get update && apt-get install tzdata).
      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 (specifically without any europe/kyiv failure).

      [OR] Trust GHA runs, that are already using PHP 8.0.23

      1. Look to the Github badges in this issue (near the branches information in this issue).
      2. Verify that all them have passed ok (green).
      Show
      Any (one) of these verifications should be enough: [OR] Testing locally. Requirements: Ensure that you are using PHP 8.0.23 ( php -v ), install it if needed. Also,ensure you've the latest time zones database, version 2022b ( apt-get update && apt-get install tzdata ). 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 (specifically without any europe/kyiv failure). [OR] Trust GHA runs, that are already using PHP 8.0.23 Look to the Github badges in this issue (near the branches information in this issue). 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 2022b that includes the change of Europe/Kiev to Europe/Kyiv (note the old name still remains as alias).

      This PHP Bug confirms it: https://bugs.php.net/bug.php?id=80254

      And this is the failure that we are getting when using the latest PHP versions using that time zones database:

      Example run, using just released 8.0.23 (September 1st): https://github.com/stronk7/moodle/actions/runs/2979120020

      1) core_date_testcase::test_timezone_lang_strings
      String for timezone europe/kyiv not found.
      Failed asserting that false is true.
       
      D:\a\moodle\moodle\lib\tests\date_test.php:174
      D:\a\moodle\moodle\lib\phpunit\classes\advanced_testcase.php:80
      

      So this issue is about to add that new Europe/Kyiv in all supported versions.

      As a reference, MDL-72953 was exactly 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)
            Matteo Scaramuccia Matteo Scaramuccia
            Jun Pataleta Jun Pataleta
            Jun Pataleta Jun Pataleta
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 15 minutes
                1h 15m

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