Skip to:
Content

BuddyPress.org

#7925 closed defect (bug) (fixed)

Nouveau: $this inside a closure doesn't work in PHP 5.3

Reported by: boonebgorges Owned by: boonebgorges
Milestone: 3.2.0 Priority: high
Severity: normal Version: 3.0.0
Component: Templates Keywords: has-patch
Cc:

Description

Prior to PHP 5.3, $this references do not inside of a closure that appears in a class method. See eg https://buddypress.trac.wordpress.org/browser/tags/3.1.0/src/bp-templates/bp-nouveau/includes/groups/loader.php?annotate=blame&marks=58#L56

This needs to be refactored out, here and anywhere else that a similar construction is used.

Attachments (1)

7925.01.patch (3.4 KB) - added by r-a-y 15 months ago.

Download all attachments as: .zip

Change History (3)

@r-a-y
15 months ago

#1 @r-a-y
15 months ago

  • Keywords has-patch added

Gah, you can blame me for this.

Attached patch replaces $this with the bp_nouveau() singleton function, which should address this issue. I don't have a PHP 5.3 rig to test this on at the moment, but it works in PHP 7.2.

#2 @boonebgorges
15 months ago

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

In 12192:

Avoid the use of $this inside closures in Nouveau AJAX handlers.

This construction is not compatible with PHP 5.3.

Props r-a-y.
Fixes #7925.

Note: See TracTickets for help on using tickets.