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

php exception because of the wrong version

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.7.3
    • Fix Version/s: 2.7.4, 2.8.2
    • Component/s: Libraries
    • Labels:
    • Testing Instructions:
      Hide
      1. Run this unit tests (won't take long):
        1. vendor/bin/phpunit lib/tests/moodlelib_test.php
      2. Verify it all passes
      3. Install Moodle 2.6 on PHP 5.3.x (for example using downloaded package from https://download.moodle.org/windows/)
      4. Replace the code in moodle directory with version 2.7 (leave the old config.php)
      5. Open the moodle instance
      6. The error about the insufficient php version should be displayed
      7. Replace with 2.8, upgrade and ensure the error is displayed
      8. Replace code with master, upgrade and ensure the error is displayed
      Show
      Run this unit tests (won't take long): vendor/bin/phpunit lib/tests/moodlelib_test.php Verify it all passes Install Moodle 2.6 on PHP 5.3.x (for example using downloaded package from https://download.moodle.org/windows/ ) Replace the code in moodle directory with version 2.7 (leave the old config.php) Open the moodle instance The error about the insufficient php version should be displayed Replace with 2.8, upgrade and ensure the error is displayed Replace code with master, upgrade and ensure the error is displayed
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-48587-master
    • Sprint:
      BACKEND Sprint 19

      Description

      Reported here: https://moodle.org/mod/forum/discuss.php?d=276367

      Parse error: syntax error, unexpected '[' in \\server\moodle\lib\moodlelib.php on line 8633
      

      This should work fine on php 5.4 and above (which is required) but it looks like the this function is called before php version check and the error message in confusing for the user.

      It's not difficult to re-write $address = explode(":", $address)[0]; into the code compatible with older php versions

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                johno John Okely
                Reporter:
                marina Marina Glancy
                Peer reviewer:
                Mark Nelson
                Integrator:
                Dan Poltawski
                Tester:
                Adrian Greeve
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  12/Jan/15