Notice: Array to string conversion in Drupal\jsonapi_search_api_facets\Plugin\facets\url_processor\JsonApiQueryString->buildUrls() (line 198)

Created on 1 April 2022, over 2 years ago
Updated 17 November 2023, 11 months ago

Problem/Motivation

I'm getting a php notice on every query:

Notice: Array to string conversion in Drupal\jsonapi_search_api_facets\Plugin\facets\url_processor\JsonApiQueryString->buildUrls() (line 198)

Steps to reproduce

You must enable "Use hierarchy" on a facet.

I have a flat taxonomy and a hierarchical taxonomy tree (two levels) that I'm using for facets. I have enabled "Use hierarchy" on the second facet (in a roundabout way via config since the Facets module doesn't like anything else enabling this).

It technically works but I get php notices. I chased down the line and it seems the module is doing an array_diff on a multidimensional array.

// line 198
$filter_params = array_diff($filter_params, [$id]);

In my case, my $filter_params looks like this:

{"landscape":["Beach Communities","Lake Communities","Mountain Communities"],"region":["173","161"]}

My query looks like this:

https://test.lndo.site/jsonapi/index/communities?filter[landscape_filter][condition][path]=landscape&filter[landscape_filter][condition][operator]=IN&filter[landscape_filter][condition][value][0]=Beach Communities&filter[landscape_filter][condition][value][1]=Lake Communities&filter[region_filter][condition][path]=region&filter[region_filter][condition][operator]=IN&filter[region_filter][condition][value][0]=173&filter[region_filter][condition][value][1]=161

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States SiliconValet

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024