Skip to:

Opened 7 years ago

Closed 7 years ago

#7469 closed defect (bug) (fixed)

Adding condition check on page delete

Reported by: raftaar1191's profile raftaar1191 Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.9 Priority: normal
Severity: normal Version: 2.8.2
Component: Core Keywords: has-patch commit


When I am running PHPUnit getting a Warning that

`PHP Warning: array_search() expects parameter 2 to be array, string given in wp-content/plugins/buddypress/src/bp-core/bp-core-functions.php on line 774

Attachments (1)

7469.patch (443 bytes) - added by raftaar1191 7 years ago.
Patch for ticket number 7469

Download all attachments as: .zip

Change History (5)

7 years ago

Patch for ticket number 7469

#1 @raftaar1191
7 years ago

  • Keywords has-patch added

#2 @johnjamesjacoby
7 years ago

  • Keywords commit added
  • Milestone changed from 2.8.3 to 2.9
  • Owner set to johnjamesjacoby
  • Status changed from new to reviewing

Hi @raftaar1191, thanks for the report.

Every usage of bp_core_get_directory_page_ids() assumes an array is returned. In addition, each usage has inconsistent type-casting on that return value.

We can (very safely) circumvent this (and potentially other similar issues) by ensuring it always returns an array, and removing the inconsistent type-casting.

#3 @johnjamesjacoby
7 years ago

This may be related to the $status parameter value of all not returning all pages in bp_core_get_directory_page_ids(). It still continues to skip the activate and register static pages. See r9180, r9189, #6043.

#4 @johnjamesjacoby
7 years ago

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

In 11513:

Core: Make sure trashed activate and register pages are unset in bp_core_get_directory_page_ids().

This flips the order of 2 conditions, which incorrectly included trashed pages for the activate & register components.

In addition, normalize the return value & type-casting of bp_core_get_directory_page_ids() to ensure it is always an array, even if an empty one.

Fixes #7469.

Note: See TracTickets for help on using tickets.