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

Passing attributes to advcheckbox form object triggers "undefined index" notice.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.1.2, 2.8.1, 2.9.4, 3.0.2, 3.1
    • Fix Version/s: 2.9.5, 3.0.3
    • Component/s: Forms Library
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide
      1. Change the line 99 on user/editadvanced.php to:

        $mform->addElement('advcheckbox', 'suspended', get_string('suspended', 'auth'), null, array('class' => 'myclass'));
        

      2. Make sure you don't get the error:

        Notice: Undefined index: group in /home/moodle/moodles/stable_master/moodle/lib/form/advcheckbox.php on line 64
        

      Show
      Change the line 99 on user/editadvanced.php to: $mform->addElement('advcheckbox', 'suspended', get_string('suspended', 'auth'), null, array('class' => 'myclass')); Make sure you don't get the error: Notice: Undefined index: group in /home/moodle/moodles/stable_master/moodle/lib/form/advcheckbox.php on line 64
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      On or about line 47 of /lib/form/advcheckbox.php is the line:

      <code>
      if (!is_null($attributes['group'])) {
      <code>

      If the attributes array doesn't contain the 'group' key, an undefined index notice will be triggered. The following line should make the notice go away:

      <code>
      if (!is_null($attributes) && array_key_exists('group', $attributes)) {
      <code>

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rushi963 Rushikesh Nalla
              Reporter:
              tbannister Tyler Bannister
              Peer reviewer:
              Simey Lameze Simey Lameze
              Integrator:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Tester:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                14/Mar/16