According to the documentation, filters (and other UI elements) can supply validation callbacks to check input from the user. However, these callbacks are never called. The problem is in the following code block:


function views_edit_view_validate($form_id, $view, $form) {
... does some stuff ...
foreach (array('field', 'argument', 'sort', 'filter') as $type) {
    $function = "_views_get_$type" . 's';
    $info = $function();
    if (is_array($view->$type)) {
      foreach ($view->$type as $key => $data) {
        if (!is_numeric($key)) {
          continue; // some non-data data is in here.
        }
        $validator = $info[$data['id']]['validate'];
        if (function_exists($validator)) {
          $validator($data, $view, $form);
        }
      }
    }

Everywhere else in the function, $views is an array. Changing the $view->$type to $view[$type] solves the problem and calls validators.

I suspect nothing every implemented a validator, so this problem was not exposed.

The supplied patch (against 4.7 dev) makes the appropriate changes to the above code block to change from object notation to array notation.

CommentFileSizeAuthor
views_check_validate0.patch761 bytesmfredrickson
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mfredrickson’s picture

Status: Active » Needs review

forgot to set status of patch

merlinofchaos’s picture

Status: Needs review » Fixed

Applied.

Anonymous’s picture

Status: Fixed » Closed (fixed)