#7838 closed defect (bug) (fixed)
Parse Error when running WP-CLI under PHP 5.3
Reported by: | ucsdmatthew | Owned by: | |
---|---|---|---|
Milestone: | 3.1.0 | Priority: | normal |
Severity: | minor | Version: | 3.0.0 |
Component: | Core | Keywords: | |
Cc: |
Description
I use wp-cli to automate maintenance of a self-hosted wordpress (currently 4.9.6) multisite installation, running under a long-term support version of Centos 6, which includes PHP 5.3 (with backported security patches).
After updating today to BuddyPress 3.0.0, when running wp-cli, we're now seeing the error:
Parse error: syntax error, unexpected '[' in /path/to/wordpress/wp-content/plugins/buddypress/cli/components/activity.php on line 902
The relevant line of code from that file is:
$r['item-id'] = \BP_Groups_Group::get_random( 1, 1 )['groups'][0]->slug;
It appears that this line (which appears twice in activity.php, as well as once in group-invite.php) uses syntax introduced in PHP 5.4 (function array dereferencing). The readme specifies a system requirement of PHP 5.3+, so presumably the use of incompatible syntax is a bug.
Thank you!
-Matthew
Change History (5)
#2
@
7 years ago
For now, the CLI extension is a seperate project and bundled in at release time, so a Github PR is the way to go: https://github.com/buddypress/wp-cli-buddypress
#4
@
7 years ago
Hi guys!
@ucsdmatthew Added a PR fixing this bug on the package Github repository.
https://github.com/buddypress/wp-cli-buddypress/pull/65
You guys can close as fixed! :)
Hi @ucsdmatthew - Thanks for the very clear report. Any interest in writing a patch that fixes the syntax? Looks like we should just have to split the calls into two separate lines.
cc @espellcaste