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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • None
    • 3.1.3, 3.1.4, 3.1.5, 3.2, 3.2.1, 3.2.2
    • Forms Library

      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)

       

            rezaie9 Shamim Rezaie
            rezaie9 Shamim Rezaie
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.