Skip to content

Fix PHP 8 type error in search category location filter when directory type is string#2763

Open
Arafat-plugins wants to merge 2 commits intosovware:trunkfrom
Arafat-plugins:trunk
Open

Fix PHP 8 type error in search category location filter when directory type is string#2763
Arafat-plugins wants to merge 2 commits intosovware:trunkfrom
Arafat-plugins:trunk

Conversation

@Arafat-plugins
Copy link

PR Type

What kind of change does this PR introduce?
This PR fixes a PHP 8+ TypeError that occurs when the _directory_type term meta is stored as a scalar string and used in search_category_location_filter().

Currently, get_term_meta( $term->term_id, '_directory_type', true ) can return a string like '191', but later is passed directly to: in_array( $settings['listing_type'], $directory_type );

  • Bugfix
  • Security fix
  • Improvement
  • New Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Text changes
  • Other... Please describe:

Description

How to reproduce the issue or how to test the changes

  1. Found PHP Fatal error: Uncaught TypeError: in_array(): Argument must be of type array, string given

Any linked issues

Fixes #
https://taiga-sovware-u10698.vm.elestio.app/project/directorist/issue/2735

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant