[buddypress-trac] [BuddyPress] #5126: BP_Group_Extension::get_screen_callback() returns values incompatible with PHP 5.2.x

buddypress-trac noreply at wordpress.org
Wed Jul 31 23:54:39 UTC 2013


#5126: BP_Group_Extension::get_screen_callback() returns values incompatible with
PHP 5.2.x
--------------------------+-------------------
 Reporter:  boonebgorges  |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  high          |  Milestone:  1.8.1
Component:  Groups        |    Version:  1.8
 Severity:  critical      |   Keywords:
--------------------------+-------------------
 In `BP_Group_Extension::get_screen_callback()`, the callback is set with
 the format:

 `array( $this->class_name, $method )`

 Because the class name is used as the first item in the array, rather than
 the object itself, you end up with the method being called statically.
 This causes a problem when a plugin uses the `$this` keyword in a callback
 (such as a `create_screen()` method using `$this->slug` to check
 something).

 For some reason, this is only causing discernible problems on PHP 5.2.x,
 where it's causing fatal errors in these cases. (See, eg,
 https://github.com/boonebgorges/buddypress-docs/issues/350.) For some
 reason I haven't figured out yet, PHP 5.3+ references the object in the
 callback rather than the class.

 In any case, this can be easily corrected by setting the callback as
 follows (non-statically):

 `array( $this, $method )`

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5126>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list