Skip to:
Content

bbPress.org

Opened 4 years ago

Closed 4 years ago

#3409 closed defect (bug) (fixed)

Issue with _bbp_pre_trashed_replies

Reported by: dungdc40's profile dungdc40 Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.6.6 Priority: normal
Severity: normal Version: 2.6.5
Component: Component - Replies Keywords: has-patch
Cc:

Description

File: includes\replies\functions.php
Line: 293
$pre_trashed_replies = (array) get_post_meta( $topic_id, '_bbp_pre_trashed_replies', true );

This line has issue, if get_post_meta() return empty string, then (array) will convert it to
array(1) {

[0]=>
string(0) ""

}
which add empty id into the array, which made the topic become not able to be unhidden later.

Attachments (1)

3409.patch (1.2 KB) - added by johnjamesjacoby 4 years ago.
Fix for trash and spam

Download all attachments as: .zip

Change History (5)

#1 @johnjamesjacoby
4 years ago

  • Component changed from General to Component - Replies
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 2.6.6
  • Owner set to johnjamesjacoby
  • Status changed from new to assigned

@johnjamesjacoby
4 years ago

Fix for trash and spam

#2 @johnjamesjacoby
4 years ago

  • Keywords has-patch added; needs-patch removed

#3 @johnjamesjacoby
4 years ago

In 7140:

Replies: prevent adding empty values to pre-spam & pre-trash meta data.

This commit filters empty values from meta data before saving them, as well as removing a simple type-cast and replacing it with a more intentional is_array() check. This new approach works because get_post_meta() will call maybe_unserialize() and always return an array if it exists, or return an empty string if it does not. If it's not an array, we know it should be an empty one.

In branches/2.6, for 2.6.6. See #3409.

#4 @johnjamesjacoby
4 years ago

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

In 7142:

Replies: prevent adding empty values to pre-spam & pre-trash meta data.

This commit filters empty values from meta data before saving them, as well as removing a simple type-cast and replacing it with a more intentional is_array() check. This new approach works because get_post_meta() will call maybe_unserialize() and always return an array if it exists, or return an empty string if it does not. If it's not an array, we know it should be an empty one.

In trunk, for 2.7. Fixes #3409.

Note: See TracTickets for help on using tickets.