Skip to:
Content

BuddyPress.org

Opened 10 years ago

Closed 10 years ago

#5736 closed enhancement (fixed)

messages_format_notifications(): variables not in scope

Reported by: wpdennis's profile wpdennis Owned by: boonebgorges's profile boonebgorges
Milestone: 2.1 Priority: normal
Severity: normal Version:
Component: Messages Keywords: needs-patch good-first-bug
Cc:

Description

If messages_format_notifications() is used with any other action than "new_message", the variables $link, $filter and $text aren't declared before usage:


if ( 'string' === $format ) {
    $return = apply_filters( $filter, '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $link, $item_id, $secondary_item_id );
} else {
    $return = apply_filters( $filter, array(
        'text' => $text,
        'link' => $link
    ), $link, (int) $total_items, $text, $link, $item_id, $secondary_item_id );
}

Attachments (1)

5736.01.patch (881 bytes) - added by wolfhoundjesse 10 years ago.
Declarations moved to top of function.

Download all attachments as: .zip

Change History (7)

#1 @DJPaul
10 years ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 2.1
  • Type changed from defect (bug) to enhancement

#2 @DJPaul
10 years ago

Should be an easy fix for someone looking to contribute a patch: just need to make sure these variables are declared sensibly at the top of the file.

#3 @DJPaul
10 years ago

  • Milestone changed from 2.1 to 2.2

#4 @wolfhoundjesse
10 years ago

This comment replaces the comment I wrote before I remembered that there is a place to enter a patch description. That is all.

Last edited 10 years ago by wolfhoundjesse (previous) (diff)

@wolfhoundjesse
10 years ago

Declarations moved to top of function.

#5 @boonebgorges
10 years ago

  • Milestone changed from 2.2 to 2.1

#6 @boonebgorges
10 years ago

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

In 8947:

In messages_format_notifications(), declare variables early, to avoid PHP notices.

Fixes #5736

Props wolfhoundjesse

Note: See TracTickets for help on using tickets.