alleyinteractive / searchpress

Elasticsearch integration for WordPress.
84 stars 12 forks source link

fix possible fatal where 'sp' is set as a query_var but is not an array #174

Closed moraleida closed 2 weeks 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