TypeError: reset(): Argument #1 ($array) must be of type array, false given in reset()

Created on 13 November 2024, about 2 months ago

Problem/Motivation

I just updated the facets module from beta1 to beta3 because I was getting this error:

Input value "page" contains a non-scalar value. in Symfony\Component\HttpFoundation\InputBag->get() (line 38 of /var/www/html/vendor/symfony/http-foundation/InputBag.php).

But now I'm seeing this error in my logs if I perform a search with no results:
TypeError: reset(): Argument #1 ($array) must be of type array, false given in reset() (line 83 of /var/www/html/docroot/modules/contrib/jsonapi_search_api/modules/jsonapi_search_api_facets/src/EventSubscriber/AddSearchMetaEventSubscriber.php).

Proposed resolution

I'm not sure if there should be a check earlier in the process to prevent it from getting this far, but checking for $facet_data before attempting to reset it prevents the php error.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States capysara

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024