Commit e74b8741 authored by borisson_'s avatar borisson_ Committed by borisson_

Issue #2871475 by borisson_: Broken facet link causes PHP warning in Query string URL processor

parent 63314a85
......@@ -173,6 +173,11 @@ class QueryString extends UrlProcessorPluginBase {
// Get the active facet parameters.
$active_params = $url_parameters->get($this->filterKey, [], TRUE);
// When an invalid parameter is passed in the url, we can't do anything.
if (!is_array($active_params)) {
return;
}
// Explode the active params on the separator.
foreach ($active_params as $param) {
$explosion = explode($this->getSeparator(), $param);
......
......@@ -146,4 +146,32 @@ class UrlIntegrationTest extends FacetsTestBase {
$this->assertFacetLabel('banana');
}
/**
* Regression test for #2871475.
*
* @link https://drupal.org/node/2871475
*/
public function testIncompleteFacetUrl() {
$id = 'owl';
$name = 'Owl';
$this->createFacet($name, $id);
$url = Url::fromUserInput('/search-api-test-fulltext');
$this->checkClickedFacetUrl($url);
// Build the path as described in #2871475.
$path = 'search-api-test-fulltext';
$options['absolute'] = TRUE;
$url = $this->buildUrl($path, $options);
$url .= '?f';
// Visit the page.
$session = $this->getSession();
$this->prepareRequest();
$session->visit($url);
// Check that no errors occurred.
$this->assertSession()->statusCodeEquals(200);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment