Skip to:
Content

bbPress.org

Opened 7 months ago

Closed 6 months ago

Last modified 6 months ago

#3636 closed defect (bug) (fixed)

Fatal error: array_merge(): Argument #1 must be of type array, string given in includes/forums/functions.php:2342

Reported by: sander-falise's profile Sander Falise Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.14 Priority: normal
Severity: major Version: 2.6.13
Component: Component - Forums Keywords: has-patch needs-testing
Cc:

Description

BBpress: 2.6.13
WP: 6.8.1
Php: 8.1.28

I found this in my log files:

PHP Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, string given in /wp-content/plugins/bbpress/includes/forums/functions.php:2342

Seems like the following doesn't always return an array, so a type check might be in order;

Get any existing not-in queries
$not_in = $posts_query->get( 'postnot_in', array() );

Add our not-in to existing
$not_in = array_unique( array_merge( $not_in, $forum_ids ) );

Change History (6)

This ticket was mentioned in PR #32 on bbpress/bbPress by @rollybueno.


6 months ago
#1

  • Keywords has-patch added

Ensures is always an array before array_merge to prevent fatal error

Issue: https://bbpress.trac.wordpress.org/ticket/3636

#2 @rollybueno
6 months ago

  • Keywords needs-testing added
  • Severity changed from normal to major

#3 @johnjamesjacoby
6 months ago

  • Milestone changed from Awaiting Review to 2.6.14
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

#4 @johnjamesjacoby
6 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7299:

Forums: cast return value of post__not_in as array.

This change avoids a potentially fatal PHP error if that query variable is a string.

Props rollybueno.

In trunk, for 2.7.

Fixes #3636.

#5 @johnjamesjacoby
6 months ago

In 7300:

Forums: cast return value of post__not_in as array.

This change avoids a potentially fatal PHP error if that query variable is a string.

Props rollybueno.

In branches/2.6, for 2.6.14.

Fixes #3636.

Note: See TracTickets for help on using tickets.