Problem/Motivation

If the f GET parameter is nested more then one level, notices are thrown. This was observed when bots where trying to find weaknesses on our live environment. A lot of notices :-)

Steps to reproduce

Append the following string to a path where facets are active

?f[0][1]

Proposed resolution

In the file facets/src/Plugin/facets/url_processor/QueryString.php in the function initializeActiveFilters a check should be added to make sure the f parameter is not nested more then one level otherwise the explode function and further will throw notices.

@@ -228,6 +228,11 @@ protected function initializeActiveFilters() {

// Explode the active params on the separator.
foreach ($active_params as $param) {
+ //make sure $param is a string
+ if (!is_string($param)) {
+ continue;
+ }
+
$explosion = explode($this->getSeparator(), $param);
$url_alias = array_shift($explosion);
$facet_id = $this->getFacetIdByUrlAlias($url_alias, $facet_source_id);

This was tested on 8.x-1.8.

CommentFileSizeAuthor
#3 facets-3202268-3.patch729 bytesgertlor

Comments

paulvb created an issue. See original summary.

paulvb’s picture

Version: 8.x-1.4 » 8.x-1.8
Issue summary: View changes
gertlor’s picture

StatusFileSize
new729 bytes

Here is a patch with the proposed solution

borisson_’s picture

Version: 8.x-1.8 » 2.0.x-dev
Status: Active » Reviewed & tested by the community

It makes sense for us to do this. Tagging for the 2.x version.

  • borisson_ committed 934dd947 on 3.0.x
    Issue #3202268 by Gertlor, paulvb, borisson_: Nested f parameter ?f[0][1...
borisson_’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 2.x and 3.x, thanks!

  • borisson_ committed 14344085 on 2.0.x
    Issue #3202268 by Gertlor, paulvb, borisson_: Nested f parameter ?f[0][1...

Status: Fixed » Closed (fixed)

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