Moodle

PHP Notice: Undefined offset: 1 in /home/arborrow/Moodle/code/19stable/lib/componentlib.class.php on line 480

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: 1.9.6
  • Fix Version/s: 1.9.8
  • Component/s: Libraries
  • Labels:
    None
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

During a recent upgrade on my test server on 19stable I came across a PHP Notice: Undefined offset: 1 in /home/arborrow/Moodle/code/19stable/lib/componentlib.class.php on line 480. Looks like we might want to check for empty like we do for 2. Peace - Anthony

p.s. I tagged this as fix for 1.9.8 and trivial since the notice does not cause any failure other than drawing attention to itself when debugging is on.

Activity

Hide
Andrew Davis added a comment -

Patch attached. I pulled this section of code out and ran it in a test page and it stubbornly refused to produce the error. Not sure why. Regardless, here is a patch that adds a guard around that line. I'll commit it after its been reviewed.

Show
Andrew Davis added a comment - Patch attached. I pulled this section of code out and ran it in a test page and it stubbornly refused to produce the error. Not sure why. Regardless, here is a patch that adds a guard around that line. I'll commit it after its been reviewed.
Hide
Anthony Borrow added a comment -

Andy - I'm not sure what may have caused it, it was on my test server so who knows. I would have to look and see how the component array was being set up but the patch looks good. I would want to better understand what the various components are to see why certain ones may be empty and under what conditions but that will have to wait for another day as I am going to bed. Peace - Anthony

Show
Anthony Borrow added a comment - Andy - I'm not sure what may have caused it, it was on my test server so who knows. I would have to look and see how the component array was being set up but the patch looks good. I would want to better understand what the various components are to see why certain ones may be empty and under what conditions but that will have to wait for another day as I am going to bed. Peace - Anthony
Hide
Petr Škoda (skodak) added a comment -

+1 for commit

Show
Petr Škoda (skodak) added a comment - +1 for commit
Hide
Andrew Davis added a comment -

committed

Show
Andrew Davis added a comment - committed

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: