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

Add environment check for versions not supporting PHP 8.4

XMLWordPrintable

    • MOODLE_405_STABLE
    • MOODLE_404_STABLE, MOODLE_405_STABLE
    • MDL-80629-404
    • MDL-80629-405
    • MDL-80629-main
    • Hide

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

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

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

      1. Install a Moodle 4.3.x site (MOODLE_403_STABLE)
      2. Upgrade to 4.4.x (MOODLE_404_STABLE)
      3. Upgrade to 4.5.x (MOODLE_405_STABLE)
      4. Verify that all the upgrades above work without problem.

      B) Using PHP 8.4.x - Upgrades to 404 & 405 with PHP 8.4 don't work

      1. Switch to PHP 8.2
      2. Install a Moodle 4.3.x site (MOODLE_403_STABLE)
        • E.g. If using MDK: "mdk create --install --version 403"
      3. Switch to PHP 8.4 (or use the "Valid trick" commented above)
      4. Check out the 404 branch and try to upgrade to 4.4.x (MOODLE_404_STABLE)
      5. Verify that upgrade doesn't work and you get the "PHP version 8.4 and higher are not supported" message.
      6. Check out the 405 branch and try to upgrade to 4.5.x (MOODLE_405_STABLE)
      7. Verify that upgrade doesn't work and you get the "PHP version 8.4 and higher are not supported" message.
      8. Check out the main branch.
      9. 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_404_STABLE main -- admin/environment.xml

        git diff MOODLE_405_STABLE main -- admin/environment.xml

      Show
      Note : Testing this issue requires, for some points, a running version of PHP 8.4. 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.4 version is hard, or if using a real PHP 8.4 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.4.0' (quotes included). That will cause the environment checks to think they are running that version. A) Using PHP 8.2.x - All upgrades work (all supported versions) Install a Moodle 4.3.x site (MOODLE_403_STABLE) Upgrade to 4.4.x (MOODLE_404_STABLE) Upgrade to 4.5.x (MOODLE_405_STABLE) Verify that all the upgrades above work without problem. B) Using PHP 8.4.x - Upgrades to 404 & 405 with PHP 8.4 don't work Switch to PHP 8.2 Install a Moodle 4.3.x site (MOODLE_403_STABLE) E.g. If using MDK: " mdk create --install --version 403 " Switch to PHP 8.4 (or use the "Valid trick" commented above) Check out the 404 branch and try to upgrade to 4.4.x (MOODLE_404_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.4 and higher are not supported" message. Check out the 405 branch and try to upgrade to 4.5.x (MOODLE_405_STABLE) Verify that upgrade doesn't work and you get the "PHP version 8.4 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_404_STABLE main -- admin/environment.xml git diff MOODLE_405_STABLE main -- admin/environment.xml
    • Hide

      Code verified against automated checks.

      Checked MDL-80629 using repository: https://github.com/andrewnicols/moodle.git

      More information about this report

      Built on: Mon Mar 31 03:12:44 UTC 2025

      Show
      Code verified against automated checks. Checked MDL-80629 using repository: https://github.com/andrewnicols/moodle.git MOODLE_404_STABLE (0 errors / 0 warnings) [branch: MDL-80629-404 | CI Job ] MOODLE_405_STABLE (0 errors / 0 warnings) [branch: MDL-80629-405 | CI Job ] main (0 errors / 0 warnings) [branch: MDL-80629-main | CI Job ] More information about this report Built on: Mon Mar 31 03:12:44 UTC 2025
    • Show
      Launching automatic jobs for branch MDL-80629 -404 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18868/ PHPUnit (sqlsrv) --> unrelated, please ignore. https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64589/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64590/ Behat (Firefox - boost) Launching automatic jobs for branch MDL-80629 -405 https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18869/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64591/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64592/ Behat (Firefox - boost) Launching automatic jobs for branch MDL-80629 -main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/18870/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64593/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64594/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64595/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/64596/ App tests (stable app version) Built on: Mon Mar 31 04:25:20 UTC 2025

      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.4 agreed to be Moodle 5.0 and up only.
      TBCs: Given the above, we need to ensure that all the branches < 5.0 have PHP capped. For this issue they are 4.4, 4.5.

      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.4 information):

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

        1. MDL-80629 A.png
          MDL-80629 A.png
          477 kB
        2. MDL-80629 B.png
          MDL-80629 B.png
          1.01 MB
        3. MDL-80629 C.png
          MDL-80629 C.png
          38 kB

            dobedobedoh Andrew Lyons
            stronk7 Eloy Lafuente (stronk7)
            Meirza Meirza
            Shamim Rezaie Shamim Rezaie
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            0 Vote for this issue
            Watchers:
            7 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, 56 minutes
                4h 56m

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