#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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 2922013-2.patch | 584 bytes | dcam |
Comments
Comment #2
dcam CreditAttribution: dcam commentedI copied over the same value-array check that is used in SearchApiViewsHandlerFilter::query().
Comment #4
jmdeleon CreditAttribution: jmdeleon commentedWas able to reproduce issue, and this patch resolves it.
Committing to dev version, release soon to follow.
Comment #5
dcam CreditAttribution: dcam commentedThanks!
Comment #6
jmdeleon CreditAttribution: jmdeleon commentedComment #7
jmdeleon CreditAttribution: jmdeleon commented