alleyinteractive / searchpress

Elasticsearch integration for WordPress.
84 stars 12 forks source link

fix possible fatal where ->sp is set but is not an array #175

Closed moraleida closed 8 months ago

moraleida commented 8 months ago

We have encountered a few cases in which get_query_var( 'sp' ) returns a string, instead of an array. This causes a fatal on line 144 below (line 179 on the nyp modified version):

PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/wp-content/plugins/searchpress/lib/class-sp-integration.php:179 

Replacing the empty check for isset will make sure we guard against that scenario.

Fixes NYP-19074

moraleida commented 8 months ago

This same change was approved in #174