#4274 closed defect (bug) (fixed)
Error bp-group-hierarchy-classes.php on line 345
Reported by: | j.conti | Owned by: | |
---|---|---|---|
Milestone: | 1.6 | Priority: | normal |
Severity: | major | Version: | 1.6 |
Component: | Core | Keywords: | |
Cc: |
Description
I activated/updated to BuddyPress 1.6 Beta 1
After the upgrade, the browser showed a white page with this error:
Fatal error: Cannot make static method BP_Groups_Group::group_exists() non static in class BP_Groups_Hierarchy in /home//public_html/wp-content/plugins/bp-group-hierarchy/bp-group-hierarchy-classes.php on line 345
Is a WordPress 3.4 Multisite
The site is now inaccessible, always shows that error.
Change History (13)
#2
@
12 years ago
- Component changed from Core to Backwards Compatability
- Keywords close removed
- Milestone changed from Awaiting Review to 1.6
- Resolution invalid deleted
- Severity changed from blocker to major
- Status changed from closed to reopened
#3
@
12 years ago
Thanks for the report. It's true that the error is reported from another the plugin, but a change in BuddyPress core broke it. So this is a backwards compatibility problem. It seems that in 1.6 we've gone through the BP_Groups_Group class and added the static function keyword to appropriate functions. At the very least, we need to un-static group_exists() but mark the function as static in the phpdoc.
I also think we should go through the entire BP_Groups_Group class, and take out any static keywords that are new in 1.6. (audit the other components' classes, too?)
#4
@
12 years ago
I also think we should go through the entire BP_Groups_Group class, and take out any static keywords that are new in 1.6. (audit the other components' classes, too?)
Yes. We should follow the WP practice of not changing the access levels on pre-PHP5 methods, for backpat reasons like this, but instead just putting it in the docblock.
#5
@
12 years ago
FWIW the same issue arises with any method access declaration (public, private, etc). These should be removed for all legacy methods. (The only real downside is that it'll cause warnings with E_STRICT turned on, but backward compatibility is far more important with existing components.)
#6
@
12 years ago
(In [6119]) Removes access declarations on legacy methods in bp-groups-classes.php
Prior versions of BuddyPress were written for PHP4 compatibility, which meant
that method visibility/access/static was not possible. WP and BP now require
PHP5, which means that new methods can use PHP5+ access declarations. However,
explicitly declaring 'static' or visibility on existing methods causes
backward compatibility issues, because any existing plugin that extends these
classes will throw fatal errors if they do not declare the same visibility/
static as the parent class.
See #4274
Upss, sorry,
Is a plugin.