Low Search error when using array in query_string
I'm getting the following error when using arrays in the query string :
( for example: ?view=list&cat[]=4&cat[]=8 )
Severity: Warning
Message: htmlspecialchars() expects parameter 1 to be string, array given
Filename: helpers/low_search_helper.php
Line Number: 352
The only code from Low Search that is used in the template where the error is, is a Low Search form tag, the form itself is not submitted. I am using GET variables in Low Search.
Replies
Low 15 Oct 2013 17:06
Can you post your Low Search Form tag? You can use http://pastie.org/ or http://pastebin.com/ for large chunks of code.
Stenvdb 15 Oct 2013 17:25
Pretty straight forward. The error only occurs when an array is in the query string.
http://pastie.org/private/yex3ijbvkuu...
Low 15 Oct 2013 17:31
How did you get the array in the URL in the first place? Manually or after a Low Search form submit?
Stenvdb 16 Oct 2013 07:44
Manually, Im using the array in the url to filter on multiple categories at once, but that's with a normal channel:entries. The Low search results tag is used on another template. I am using ee 2.7.1 and Low Search 2.4.2
If you cannot reproduce the error I will give you a login to our staging environment.
Low 16 Oct 2013 17:04
Well, I can reproduce, but only if I "hack" the URL. Submitting the Low Search form doesn't cause the error.
That said, the GET vars shouldn't contain arrays anyway for LS. A fix would mean ignoring any arrays in GET.
Stenvdb 16 Oct 2013 17:59
I understand, but the array isn't meant for low search, it's just there in the same url together with some low search GET vars. The array shouldn't necessarily brake Low Search? I can find a way around it, but it should work together. An array in GET vars is not that unusual and natively supported in php?
Low 16 Oct 2013 18:56
No, it shouldn't break. But I thought you expected it to be input for LS. To fix, open up mod.low_search.php and look up line 1353, which reads:
Change that to:
Stenvdb 17 Oct 2013 07:24
Thanks, fixed it!