Moodle
  1. Moodle
  2. MDL-20966

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

    Details

    • Type: Bug Bug
    • Status: 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
    • Rank:
      24664

      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.

      1. componentlib.class.php.patch
        0.8 kB
        Andrew Davis
      1. componentlib.png
        140 kB

        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 added a comment -

        +1 for commit

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

        committed

        Show
        Andrew Davis added a comment - committed

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: