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

Add environment check for versions not supporting PHP 8.0

XMLWordPrintable

    • MOODLE_310_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Hide

      Note: Testing this issue requires, for some points, a running version of PHP 8.0. Also, it requires other issues in the PHP 8.0 epic (MDL-70745) 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.0 version is hard, or if using a real PHP 8.0 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.0.0' (quotes included). That will cause the environment checks to think they are running that version.

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

      1. Install a Moodle 3.7.x site (MOODLE_37_STABLE)
      2. Upgrade to 3.8.x (MOODLE_38_STABLE)
      3. Upgrade to 3.9.x (MOODLE_39_STABLE)
      4. Upgrade to 3.10.x (MOODLE_310_STABLE)
      5. Upgrade to 3.11dev (MOODLE_311_STABLE)
      6. Upgrade to 4.0dev (master).
      7. Verify that all the upgrades above work without problem.

      B) Using PHP 7.3.x - Upgrades to 38, 39 & 310 with PHP 8.0 don't work

      1. Install a Moodle 3.7.x site (MOODLE_37_STABLE)
      2. Switch to PHP 8.0 (or use the "Valid trick" commented above)
      3. Try to upgrade to 3.8.x (MOODLE_38_STABLE)
      4. Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message.
      5. Try to upgrade to 3.9.x (MOODLE_39_STABLE)
      6. Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message.
      7. Try to upgrade to 3.10.x (MOODLE_310_STABLE)
      8. Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message.
      9. Try to upgrade to 3.11dev (MOODLE_311_STABLE).
      10. Verify that the upgrade works without problem.
      11. Try to upgrade to 4.0dev (master).
      12. 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_35_STABLE master -- admin/environment.xml
        git diff MOODLE_38_STABLE master -- admin/environment.xml
        git diff MOODLE_39_STABLE master -- admin/environment.xml
        git diff MOODLE_310_STABLE master -- admin/environment.xml
        git diff MOODLE_311_STABLE master -- admin/environment.xml
        

      Show
      Note: Testing this issue requires, for some points, a running version of PHP 8.0. Also, it requires other issues in the PHP 8.0 epic ( MDL-70745 ) 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.0 version is hard, or if using a real PHP 8.0 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.0.0' (quotes included). That will cause the environment checks to think they are running that version. A) Using PHP 7.3.x - All upgrades work (all supported versions) Install a Moodle 3.7.x site (MOODLE_37_STABLE) Upgrade to 3.8.x (MOODLE_38_STABLE) Upgrade to 3.9.x (MOODLE_39_STABLE) Upgrade to 3.10.x (MOODLE_310_STABLE) Upgrade to 3.11dev (MOODLE_311_STABLE) Upgrade to 4.0dev (master). Verify that all the upgrades above work without problem. B) Using PHP 7.3.x - Upgrades to 38, 39 & 310 with PHP 8.0 don't work Install a Moodle 3.7.x site (MOODLE_37_STABLE) Switch to PHP 8.0 (or use the "Valid trick" commented above) Try to upgrade to 3.8.x (MOODLE_38_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message. Try to upgrade to 3.9.x (MOODLE_39_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message. Try to upgrade to 3.10.x (MOODLE_310_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.0 is not supported" message. Try to upgrade to 3.11dev (MOODLE_311_STABLE). Verify that the upgrade works without problem. Try to upgrade to 4.0dev (master). 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_35_STABLE master -- admin/environment.xml git diff MOODLE_38_STABLE master -- admin/environment.xml git diff MOODLE_39_STABLE master -- admin/environment.xml git diff MOODLE_310_STABLE master -- admin/environment.xml git diff MOODLE_311_STABLE master -- admin/environment.xml

      PHP 7.4 is supported from Moodle 3.8.

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

      We should introduce a restricted PHP version check for PHP versions >= 7.4 into 3.8, 3.9 and 3.10.

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

      See previous MDL-66262 as reference for this and the behavior in previous branches (3.6 and 3.7).

      Usual changes to perform to Moodle Docs include (updated to the new PHP 8.0 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.

      From the original report, some months ago (now outdated because PHP 8.0 is already out):

      Changes are added to all supported versions (security-only included).

      We should really have done this when we removed the 7.4 restricted version check as we always knew that 7.4 was the benchmark, and not a higher version.

      I feel it's better to make this change now, and not when 8.0 is out because some people will not update Moodle in the interim.

            stronk7 Eloy Lafuente (stronk7)
            dobedobedoh Andrew Lyons
            Marina Glancy Marina Glancy
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Janelle Barcega Janelle Barcega
            Votes:
            2 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 30 minutes
                4h 30m

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