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

Add environment check for versions not supporting PHP 8.3

XMLWordPrintable

    • MOODLE_402_STABLE
    • MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-76441_401
    • MDL-76441_403
    • Hide

      Note: Testing this issue requires, for some points, a running version of PHP 8.3.

      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.3 version is hard, or if using a real PHP 8.3 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.3.0' (quotes included). That will cause the environment checks to think they are running that version.

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

      1. Install a Moodle 4.0.x site (MOODLE_400_STABLE)
      2. Upgrade to 4.1.x (MOODLE_401_STABLE)
      3. Upgrade to 4.2.x (MOODLE_402_STABLE)
      4. Upgrade to 4.3.x (MOODLE_403_STABLE)
      5. Verify that all the upgrades above work without problem.

      B) Using PHP 8.3.x - Upgrades to 402 & 403 with PHP 8.3 don't work

      1. Switch to PHP 8.2 or lower (Not lower than 8.0)
      2. Install a Moodle 4.0.x site (MOODLE_400_STABLE)
        • E.g. If using MDK: "mdk create --integration --install --version 400"
      3. Switch to PHP 8.3 (or use the "Valid trick" commented above)
      4. Check out the 401 branch and try to upgrade to 4.1.x (MOODLE_401_STABLE)
      5. Verify that upgrade doesn't work and you get the "PHP version 8.2 and higher are not supported" message.
      6. Check out the 402 branch and try to upgrade to 4.2.x (MOODLE_402_STABLE)
      7. Verify that upgrade doesn't work and you get the "PHP version 8.3 and higher are not supported" message.
      8. Check out the 403 branch and try to upgrade to 4.3.x (MOODLE_403_STABLE)
      9. Verify that upgrade doesn't work and you get the "PHP version 8.3 and higher are not supported" message.
      10. Check out the main branch.
      11. Verify that the upgrade works without problem (might have errors, but the environment checks don't prevent it).

      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_401_STABLE main – admin/environment.xml
        • git diff MOODLE_402_STABLE main – admin/environment.xml
        • git diff MOODLE_403_STABLE main – admin/environment.xml
      Show
      Note : Testing this issue requires, for some points, a running version of PHP 8.3. 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.3 version is hard, or if using a real PHP 8.3 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.3.0' (quotes included). That will cause the environment checks to think they are running that version. A) Using PHP 8.0.x - All upgrades work (all supported versions) Install a Moodle 4.0.x site (MOODLE_400_STABLE) Upgrade to 4.1.x (MOODLE_401_STABLE) Upgrade to 4.2.x (MOODLE_402_STABLE) Upgrade to 4.3.x (MOODLE_403_STABLE) Verify that all the upgrades above work without problem. B) Using PHP 8.3.x - Upgrades to 402 & 403 with PHP 8.3 don't work Switch to PHP 8.2 or lower (Not lower than 8.0) Install a Moodle 4.0.x site (MOODLE_400_STABLE) E.g. If using MDK: " mdk create --integration --install --version 400 " Switch to PHP 8.3 (or use the "Valid trick" commented above) Check out the 401 branch and try to upgrade to 4.1.x (MOODLE_401_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.2 and higher are not supported" message. Check out the 402 branch and try to upgrade to 4.2.x (MOODLE_402_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.3 and higher are not supported" message. Check out the 403 branch and try to upgrade to 4.3.x (MOODLE_403_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.3 and higher are not supported" message. Check out the main branch. Verify that the upgrade works without problem (might have errors, but the environment checks don't prevent it). 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_401_STABLE main – admin/environment.xml git diff MOODLE_402_STABLE main – admin/environment.xml git diff MOODLE_403_STABLE main – admin/environment.xml

      Requirement: The target versions for a given PHP version must have been decided. Only then, the TBC (to be capped) branches can be amended by this issue.

      Target agreement: PHP 8.3 agreed to be Moodle 4.4 and up (as of January 15th 2024).
      TBCs: Given the above, we need to ensure that all the branches < 4.4 have PHP capped. For this issue they are: 4.2 and 4.3.

      Implementation details (once Target and TBCs are clear):

      • Here we have to cap all the TBCs branches that are still uncapped.
      • DEV branches (usually "main") aren't capped ever.
      • This change must be applied to ALL supported branches, including security-only ones.
      • Usual changes to perform to Moodle Docs include (updated to the new PHP 8.3 information):

      See previous issue (this is a clone of it) as a reference for this and the behaviour in previous branches.

        1. MDL-76441-A.png
          MDL-76441-A.png
          805 kB
        2. MDL-76441-B.png
          MDL-76441-B.png
          1.18 MB
        3. MDL-76441-C.png
          MDL-76441-C.png
          498 kB

            stronk7 Eloy Lafuente (stronk7)
            dobedobedoh Andrew Lyons
            Andrew Lyons Andrew Lyons
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 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, 47 minutes
                4h 47m

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