Skip to:
Content

bbPress.org

Changeset 7297


Ignore:
Timestamp:
04/30/2025 06:56:35 PM (6 weeks ago)
Author:
johnjamesjacoby
Message:

Search: Avoid PHP warnings if search terms are a nested array.

This commit modifies the bbp_sanitize_search_request() function to filter out all non-scalar values from the requested values, ensuring that unsupported formats (arrays of arrays specifically) are ignored.

Props dd32.

In the 2.6 branch, for 2.6.14.

See #3634.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.6/src/includes/search/functions.php

    r6903 r7297  
    125125    }
    126126
    127     // Maybe implode if an array
     127    // Special case for array of terms
    128128    if ( is_array( $terms ) ) {
     129
     130        // Filter out any non-scalar array values, to avoid PHP warnings
     131        $terms = array_filter( $terms, 'is_scalar' );
     132
     133        // Implode terms with spaces, to sanitize later
    129134        $terms = implode( ' ', $terms );
    130135    }
Note: See TracChangeset for help on using the changeset viewer.