After upgrading to 7.x.1.25 the bellow error begun:
Warning: Illegal string offset 'value' in SearchApiViewsHandlerFilterDate->query() (line 154 of ***/www/html/sites/all/modules/search_api/contrib/search_api_views/includes/handler_filter_date.inc).

Tracked this issue to
https://www.drupal.org/node/1783746
https://www.drupal.org/files/issues/2018-05-15/1783746-92--between_opera...

Outlining the issue from the change:

    else {
      while (is_array($this->value)) {
        $this->value = $this->value ? reset($this->value) : NULL;
      }
      $v = is_numeric($this->value) ? $this->value : strtotime($this->value, REQUEST_TIME);
      if ($v !== FALSE) {
        $this->query->condition($this->real_field, $v, $this->operator, $this->options['group']);
      }
    }
      $value = isset($this->value[0]) ? $this->value[0]['value'] : $this->value['value'];
      $v = is_numeric($value) ? $value : strtotime($value, REQUEST_TIME);
      if ($v !== FALSE) {
        $this->query->condition($this->real_field, $v, $this->operator, $this->options['group']);
      }

Output from this variable just before the error:

SearchApiViewsHandlerFilterDate Object
(
    [value] => Array
        (
            [0] => 2018-10-01
        )

It seems that the structure of the object is different than anticipated in the change done.

The fix I used and works for me, but not sure if it should be rolled back to the way it was.

--      $value = isset($this->value[0]) ? $this->value[0]['value'] : $this->value['value'];
++      $value = isset($this->value[0]) ? $this->value[0] : $this->value;

Also there is an empty line to be removed on line 160.

Using datepicker for the date selection.

Comments

kpolychr created an issue. See original summary.

kpolychr’s picture

Issue summary: View changes
kpolychr’s picture

Issue summary: View changes
jelle_s’s picture

Status: Active » Needs review
StatusFileSize
new785 bytes
drunken monkey’s picture

StatusFileSize
new980 bytes
new998 bytes

Thanks for reporting!
As always, it’s very hard to tell what’s really going on in Views. So, when fixing this, we should probably just opt for the maximum in safety we can get here – see the attached patch. Please test/review!

markabur’s picture

Thanks, #5 works for me. Before, I was getting the error in the OP, and date-based searches returned nothing. Now the site is back to working again.

Anonymous’s picture

Patch #5 helped me also.
The issue 'Warning: Illegal string offset 'value' in SearchApiViewsHandlerFilterDate->query() (line 154 of .... /search_api/contrib/search_api_views/includes/handler_filter_date.inc).'is gone!
Thanks.

drunken monkey’s picture

Component: General code » Views integration
Status: Needs review » Fixed

Thanks a lot for reporting back! Glad to hear this fixed the error for you.
Committed.
Thanks again, everyone!

Status: Fixed » Closed (fixed)

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