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

Add environment check for versions not supporting PHP 8.0

    XMLWordPrintable

    Details

    • Testing Instructions:
      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
    • Affected Branches:
      MOODLE_310_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_310_STABLE, MOODLE_35_STABLE, MOODLE_38_STABLE, MOODLE_39_STABLE
    • Pull 3.9 Branch:
    • Pull 3.10 Branch:
      MDL-68735_310
    • Pull 3.11 Branch:
      MDL-68735_311
    • Pull Master Branch:

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              dobedobedoh Andrew Lyons
              Peer reviewer:
              Marina Glancy Marina Glancy
              Integrator:
              Sara Arjona (@sarjona) Sara Arjona (@sarjona)
              Tester:
              Janelle Barcega Janelle Barcega
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Mar/21

                  Time Tracking

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