#5126 closed defect (bug) (fixed)
BP_Group_Extension::get_screen_callback() returns values incompatible with PHP 5.2.x
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 1.8.1 | Priority: | high |
Severity: | critical | Version: | 1.8 |
Component: | Groups | Keywords: | |
Cc: |
Description
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 )
In 7332: