When trying to add a "filter" to a View and choose "Storm: Task Priority", throws an error:

warning: preg_match() expects parameter 2 to be string, array given in /var/www/includes/bootstrap.inc on line 771.

CommentFileSizeAuthor
#9 Picture 1.png107.39 KBtiyberius
#6 Picture 1.png15.46 KBtiyberius

Comments

Magnity’s picture

Priority: Critical » Normal

Confirmed this, and also that it happens on a couple of the other fields where the filter is taken from the Storm attributes setting.

Magnity’s picture

Title: Filter by "Storm: Task Priority" » preg_match error when filtering views based on storm attributes
Component: Storm Task » Storm Attribute

Broadening title to include #502358: Error when dealing with "Storm: Project Status" in views which I believe is the same issue.

homoludens’s picture

i have solved this problem for me. problem was that "stormattribute_handler_filter_attributes_domain" is calling "stormattribute_attributes_bydomain" to get "$this->value_options":

<?php
class stormattribute_handler_filter_attributes_domain extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_options = stormattribute_attributes_bydomain($this->definition['domain']);
    }
  }
}
?>

and it is returning, double array:

Array
(
    [values] => Array
        (
            [inserted] => inserted
            [in progress] => in progress
            [on hold] => on hold
            [completed] => completed
        )

    [default] => inserted
)

while it only needs array of "values"

so mine solution was to only add line:

<?php
$this->value_options = $this->value_options['values'];
?>

so it looks like:

<?php
class stormattribute_handler_filter_attributes_domain extends views_handler_filter_in_operator {
  function get_value_options() {
    if (!isset($this->value_options)) {
      $this->value_options = stormattribute_attributes_bydomain($this->definition['domain']);
      $this->value_options = $this->value_options['values'];
    }
  }
}
?>

it's working for me, but some confirmation and better solution is very much welcomed.

Magnity’s picture

Thanks @homoludens, it seems to work for me.

@tiyberius, does this work for you too?

Magnity’s picture

Status: Active » Fixed

Decided to commit since both of us found it fixed the bug.

http://drupal.org/cvs?commit=230918

tiyberius’s picture

Status: Fixed » Active
StatusFileSize
new15.46 KB

This commit certainly gets rid of the error message, but I think the feature is still broken. Even when I select the radio button "Is one of:" and then select all the fields (basically, is the task of ANY status), it doesn't return any results. Can anyone confirm this?

homoludens’s picture

i have tried it again, and it is working for me.
i even use it like exposed view.
and tried it with both operators: "Is one of" and "Is not one of" for different fields.

Magnity’s picture

It's also working for me.

Which fields are you trying to see? - it might be that there is an issue with a particular one, or that another filter is getting in the way?

tiyberius’s picture

StatusFileSize
new107.39 KB

hmmm, interesting. Attached is a screenshot of my setup ... maybe I have some things out of order? I tried rearranging the filters to no avail.

I should mention that even with everything selected, it returns no results.

homoludens’s picture

hmmm, interesting. everything looks ok.
so what versions of views and storm are you using?
have you tried latest dev for storm?

tiyberius’s picture

Sorry! It looks like I was the source of the error. Originally, my filter was set to "Storm: Project Status" when it should have been "Storm: TASK Status". Doh!

tiyberius’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.