Skip to:
Content

bbPress.org

Opened 7 weeks ago

Closed 7 weeks ago

#3634 closed defect (bug) (fixed)

Nested arrays in search requests causing PHP warnings

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.14 Priority: high
Severity: normal Version: 2.6.0
Component: Component - Search Keywords: has-patch
Cc:

Description

See: https://github.com/bbpress/bbPress/pull/31

A request such as ?ts[]=term passes through this function, but ?ts[][]=term causes a PHP Warning: Array to string conversion.

As it attempts to run: implode($separator = ' ', $array = [ 0 => [0 => 'term']])

Change History (2)

#1 @johnjamesjacoby
7 weeks ago

In 7297:

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.

#2 @johnjamesjacoby
7 weeks ago

  • Owner set to johnjamesjacoby
  • Resolution set to fixed
  • Status changed from new to closed

In 7298:

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 trunk, for 2.7.

Fixes #3634.

Note: See TracTickets for help on using tickets.