PHP errors when using results tag with no query param
Hi,
I've just installed the latest version of low search and there's, what I assume is, a pretty critical bug for me as it completely breaks sites, or at the least a huge backwards compatibility breakage (if so, warning would be appreciated please!). Leaving out the query parameter on the results tag used to just apply all other params, but now completely breaks the site, causing PHP errors and returning everything in all search indexes regardless of other parameters.
Is this now expected behavior, or just an oversight? I've included further details and a quick fix below, but would be good to know what the intention was :)
Cheers,
Rob
The php errors in question are:
A PHP Error was encountered
Severity: Warning
Message: array_merge() [function.array-merge]: Argument #1 is not an array
Filename: low_search/mod.low_search.php
Line Number: 306
A PHP Error was encountered
--------------
Severity: Warning
Message: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object
Filename: low_search/mod.low_search.php
Line Number: 325
and the tag used to generate this is simply {exp:low_search:results collection="name"}
It appears to be caused by changes in the way the decoding of the query param is handled, as the decode function now returns false and no empty array is forced in this case. It can be fixed by adding
if ($this->params === false) {
$this->params = array();
}
to line 302 in mod.low_search.php
Replies
Low 8 Nov 2012 17:29
That's rather unfortunate and shouldn't be the case. As soon as I'm back home (on the road ATM), I'll try and reproduce and get a fix out.
Low 9 Nov 2012 09:23
Version 2.1.2 should fix this.
Rob Gamm 9 Nov 2012 10:47
Great, thanks for the speedy resolution!