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

MoodleQuickForm_editor::getValue() is not compatible with MoodleQuickForm::exportValues() logic

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.1.3, 3.1.4, 3.1.5, 3.2, 3.2.1, 3.2.2
    • Fix Version/s: None
    • Component/s: Forms Library
    • Labels:

      Description

      The MoodleQuickForm_editor::getValue() returns an array of null values if the editor field is disabled or even not present in the form for any reason.

      This makes MoodleQuickForm::exportValues() to fail and think something is submitted.

      More explanation:

      The MoodleQuickForm::exportValues method has the following bit:

      $value = $this->_elements[$key]->exportValue($this->_submitValues, true);
      //...
      if (is_array($value)) {
          // This shit throws a bogus warning in PHP 4.3.x
          $unfiltered = HTML_QuickForm::arrayMerge($unfiltered, $value);
      }
      

      So it checks if the exportValue returns an array and if it does, considers the returned value as either the user's submitted data or the default value of the field.

      All fields return null if they don't have any value except editor fields. They return an array of null. In particular, they return

      array('text'=>null, 'format'=>null, 'itemid'=>null)

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rezaie9 Shamim Rezaie
              Reporter:
              rezaie9 Shamim Rezaie
              Peer reviewer:
              Damyon Wiese
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: