Hello,
I have recently updated on a website the Search API module to its latest version. I also have installed Solr and Facet API to latest version. So:
Search API 7.x-1.11
Facet API 7.x-1.3
Search API Solr 7.x-1.4
Views 7.x-3.7
Now I am experiencing this error when I try to edit a view that I created previously (I can't rememeber exactly versions of the modules at the time of the creation of the view)
Recoverable fatal error: Argument 1 passed to SearchApiViewsHandlerFilterTaxonomyTerm::ids_to_strings() must be an array, string given, called in /var/www/perilmiofuturogiovani.tn.it/sites/all/modules/search_api/contrib/search_api_views/includes/handler_filter_entity.inc on line 179 and defined in SearchApiViewsHandlerFilterTaxonomyTerm->ids_to_strings() (linea 286 di /var/www/perilmiofuturogiovani.tn.it/sites/all/modules/search_api/contrib/search_api_views/includes/handler_filter_taxonomy_term.inc).
I checked the code and it is:
/**
* {@inheritdoc}
*/
public function admin_summary() {
$value = $this->value;
$this->value = empty($value) ? '' : $this->ids_to_strings($value);
$ret = parent::admin_summary();
$this->value = $value;
return $ret;
}
I was able to fix it with a slight change adding a check and cast, but I do not know if it is correct. Anyway after that I was able to edit the view again
/**
* {@inheritdoc}
*/
/*
* Added check on $value to see if it is an array
*/
public function admin_summary() {
$value = $this->value;
$this->value = (empty($value) || !is_array($value)) ? '' : $this->ids_to_strings($value);
$ret = parent::admin_summary();
$this->value = $value;
return $ret;
}
I also attach a file with exported code of the view.
Maybe someone who is more aware of the Search API code could give it a look and see if it's something that need to be fixed or it was just the consequence of my particular settings and the update of the modules.
Thanks
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | 2198261-1--views_term_filter_legacy.patch | 710 bytes | drunken monkey |
| view-exported-code.txt | 14.32 KB | gp.mazzola |
Comments
Comment #1
drunken monkeyThanks for reporting this issue!
Yes, this can be a problem after updating, we switch to always use arrays of values internally in these filters (taxonomy terms and users).
value_form()already has a check to guard against legacy scalar values, but it seems we forgot that inadmin_summary().Try the attached patch, it should fix your problem and also keep your previous setting.
Comment #2
gp.mazzola commentedHi Drunken Monkey,
thank you for your answer!
I tried the patch and it worked for me: problem fixed!
Thanks,
G.Paolo
Comment #3
drunken monkeyThanks for testing, good to hear it worked!
Committed.