#2853262: Add token substitution to views filter value introduced token replacement for Sarnia's Data filters in Views.

If the Data filter is exposed, the value property of SearchApiViewsHandlerFilter becomes an array instead of a string. SarniaViewsHandlerFilter::query() passes this array to token_replace(), then to token_scan(), then to preg_match_all() resulting in this error:
Warning: preg_match_all() expects parameter 2 to be string, array given in token_scan() (line 124 of C:\wamp\www\awic\includes\token.inc).

If you look through SearchApiViewsHandlerFilter, you can see that it accounts for the possibility of the value property being an array in a few different places. SarniaViewsHandlerFilter::query() must account for it as well.

To reiterate, the (Sarnia index): Data filter must be exposed to reproduce the error. It does not matter whether you enter anything into the value field in the filter form or not.

Patch to follow.

CommentFileSizeAuthor
#2 2922013-2.patch584 bytesdcam
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dcam created an issue. See original summary.

dcam’s picture

Status: Active » Needs review
FileSize
584 bytes

I copied over the same value-array check that is used in SearchApiViewsHandlerFilter::query().

  • jmdeleon committed 035ce7d on 7.x-1.x authored by dcam
    Issue #2922013 by dcam: Exposed Data filters cause warnings in...
jmdeleon’s picture

Was able to reproduce issue, and this patch resolves it.

Committing to dev version, release soon to follow.

dcam’s picture

Thanks!

jmdeleon’s picture

Status: Needs review » Fixed
jmdeleon’s picture

Status: Fixed » Closed (fixed)