Uploaded image for project: '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
    • Status: Closed
    • Priority: 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.

        Gliffy Diagrams

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

          Activity

          Hide
          andyjdavis 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
          andyjdavis 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
          aborrow 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
          aborrow 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
          skodak Petr Skoda added a comment -

          +1 for commit

          Show
          skodak Petr Skoda added a comment - +1 for commit
          Hide
          andyjdavis Andrew Davis added a comment -

          committed

          Show
          andyjdavis Andrew Davis added a comment - committed

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                25/Mar/10