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

Add environment check for versions not supporting PHP 8.1

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MOODLE_311_STABLE, MOODLE_39_STABLE, MOODLE_400_STABLE, MOODLE_401_STABLE
    • MDL-73017-M401_add-environment-check-for-versions-not-supporting-php-8-1
    • MDL-73017_add-environment-check-for-versions-not-supporting-php-8-1
    • Hide

      Note: Testing this issue requires, for some points, a running version of PHP 8.1. Also, it requires other issues in the PHP 8.1 epic (MDL-73016) to be fixed.

      Note: It's better to try all the upgrades in the steps below using the CLI command:
      php admin/cli/upgrade.php

      Valid trick: If finding a working PHP 8.1 version is hard, or if using a real PHP 8.1 is still impossible because of other errors... the lib/environmentlib.php file can be edited, after every checkout, replacing the two existing calls to phpversion() by, simply: '8.1.0' (quotes included). That will cause the environment checks to think they are running that version.

      A) Using PHP 7.4.x - All upgrades work (all supported versions)

      1. Install a Moodle 3.8.x site (MOODLE_38_STABLE)
      2. Upgrade to 3.9.x (MOODLE_39_STABLE)
      3. Upgrade to 3.11.x (MOODLE_311_STABLE)
      4. Upgrade to 4.0.x (MOODLE_400_STABLE)
      5. Upgrade to 4.1.x (MOODLE_401_STABLE)
      6. Verify that all the upgrades above work without problem.

      B) Using PHP 8.1.x - Upgrades to 39, 311 & 400 with PHP 8.1 don't work

      1. Switch to PHP 7.4
      2. Install a Moodle 3.8.x site (MOODLE_38_STABLE)
        • E.g. If using MDK: "mdk create --integration --install --version 38"
      3. Switch to PHP 8.1 (or use the "Valid trick" commented above)
      4. Check out the 39 branch and try to upgrade to 3.9.x (MOODLE_39_STABLE)
      5. Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message.
      6. Check out the 311 branch and try to upgrade to 3.11.x (MOODLE_311_STABLE)
      7. Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message.
      8. Check out the 400 branch and try to upgrade to 4.0.x (MOODLE_400_STABLE)
      9. Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message.
      10. Check out the 401 branch and try to upgrade to 4.1.x (MOODLE_401_STABLE).
      11. Verify that the upgrade works without problem.

      C) Confirm that environment.xml is 100% the same over all branches

      1. Verify that the following git commands return no differences (empty output)

        git diff MOODLE_39_STABLE master -- admin/environment.xml
        git diff MOODLE_311_STABLE master -- admin/environment.xml
        git diff MOODLE_400_STABLE master -- admin/environment.xml
        git diff MOODLE_401_STABLE master -- admin/environment.xml 

      Show
      Note : Testing this issue requires, for some points, a running version of PHP 8.1. Also, it requires other issues in the PHP 8.1 epic ( MDL-73016 ) to be fixed. Note : It's better to try all the upgrades in the steps below using the CLI command: php admin/cli/upgrade.php Valid trick : If finding a working PHP 8.1 version is hard, or if using a real PHP 8.1 is still impossible because of other errors... the lib/environmentlib.php file can be edited, after every checkout, replacing the two existing calls to phpversion() by, simply: '8.1.0' (quotes included). That will cause the environment checks to think they are running that version. A) Using PHP 7.4.x - All upgrades work (all supported versions) Install a Moodle 3.8.x site (MOODLE_38_STABLE) Upgrade to 3.9.x (MOODLE_39_STABLE) Upgrade to 3.11.x (MOODLE_311_STABLE) Upgrade to 4.0.x (MOODLE_400_STABLE) Upgrade to 4.1.x (MOODLE_401_STABLE) Verify that all the upgrades above work without problem. B) Using PHP 8.1.x - Upgrades to 39, 311 & 400 with PHP 8.1 don't work Switch to PHP 7.4 Install a Moodle 3.8.x site (MOODLE_38_STABLE) E.g. If using MDK: " mdk create --integration --install --version 38 " Switch to PHP 8.1 (or use the "Valid trick" commented above) Check out the 39 branch and try to upgrade to 3.9.x (MOODLE_39_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message. Check out the 311 branch and try to upgrade to 3.11.x (MOODLE_311_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message. Check out the 400 branch and try to upgrade to 4.0.x (MOODLE_400_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.1 and higher are not supported" message. Check out the 401 branch and try to upgrade to 4.1.x (MOODLE_401_STABLE). Verify that the upgrade works without problem. C) Confirm that environment.xml is 100% the same over all branches Verify that the following git commands return no differences (empty output) git diff MOODLE_39_STABLE master -- admin/environment.xml git diff MOODLE_311_STABLE master -- admin/environment.xml git diff MOODLE_400_STABLE master -- admin/environment.xml git diff MOODLE_401_STABLE master -- admin/environment.xml

      Requirement: We need the MOODLE_400_STABLE and the MOODLE_401_STABLE branch to exist to proceed with this (4.0.0 and 4.1.0 release).

      PHP 8.0 is supported from Moodle 3.11 onwards.

      The next version of PHP is 8.1 and it's planned to be supported by Moodle 4.1 and up.

      We should introduce a restricted PHP version check for PHP versions >= 8.0 into 3.11, for PHP versions >= 8.1 into 4.0 and for PHP versions >= 8.2 into 4.1.

      This change must be applied to ALL supported branches, including security-only ones.

      See previous MDL-68735 as a reference for this and the behaviour in previous branches (3.8, 3.9 and 3.10).

      Usual changes to perform to Moodle Docs include (updated to the new PHP 8.1 information):

      • TODO: A note in the PHP Versions page about the WIP and the current status, like this.
      • TODO: (docs_required) Whenever the new version release notes is available, something like this.

            Daniel Ziegenberg Daniel Ziegenberg
            stronk7 Eloy Lafuente (stronk7)
            Simey Lameze Simey Lameze
            Jun Pataleta Jun Pataleta
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 36 minutes
                3h 36m

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