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

One more array_key_exists() on objects

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.8, 3.9
    • Fix Version/s: 3.8.1
    • Component/s: General, Gradebook
    • Labels:

      Description

      This case escaped MDL-66968 because the structure should be clearly an array. And was hidden behind other ongoing php74 fixes still not integrated.

      You can see the problem happening here: https://ci.moodle.org/view/Testing/job/DEV.74%20-%20PHPUnit%207.4%20-%20MDL-66260/5/ (search for array_key_exists in the console -> view as text output.

      There you will find 8 failures caused by grade/grading/form/rubric/lib.php:389.

      After becoming a little bit crazy, it was discovered that the problem is the json_decode() call some lines above that returns the associative array as an object.

      So, the fix is, simply, about to add the 2nd parameter to that call in order to get the information returned as array, making php74 array_key_exists happy.

      Here there is another run of the same job above, with the patch applied: https://ci.moodle.org/view/Testing/job/DEV.74%20-%20PHPUnit%207.4%20-%20MDL-66260/6/

      You can see that there are 8 less failures and that, in the console -> view as text output there isn't any remaining array_key_exists occurrence.

        Attachments

          Activity

            People

            Assignee:
            stronk7 Eloy Lafuente (stronk7)
            Reporter:
            stronk7 Eloy Lafuente (stronk7)
            Peer reviewer:
            Mathew May
            Integrator:
            Jake Dallimore
            Tester:
            CiBoT
            Participants:
            Component watchers:
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              13/Jan/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 10 minutes
                1h 10m