Support » Plugin: Restricted Site Access » PHP version issue with WP-CLI support

  • Are you trying to maintain compatibility with older versions of PHP, as some plugin authors are doing? The new wp-cli support seems to break the plugin in my older environment.

    Web hosting environment: Red Hat 6, which is PHP 5.3.3 (plus a ton of backported security and bug fixes), running any wp-cli command on the site errors out in what appears to be a PHP 5.4 type array constructor:

    PHP Parse error: syntax error, unexpected '[' in /var/www/html/hrpo-test.wustl.edu/wp-content/plugins/restricted-site-access/wp-cli.php on line 356

    CentOS 6 should be functionally equivalent, if you need a way to reproduce this.

    The plugin itself at first glance appears to work just fine, it’s only when the wp-cli file is included (which normally only happens when using wp-cli, obviously).

Viewing 3 replies - 1 through 3 (of 3 total)
  • (Mods: Please remove the modlook tag, that was a mis-click on my part)

    Plugin Author Helen Hou-Sandi

    (@helen)

    4.0 and 4.7 Release Lead

    WP CLI requires PHP 5.4 or higher so while the rest of this plugin still retains PHP 5.2 compat for the moment, I don’t see that CLI support needs to be written that way. I’m sorry that Restricted Site Access’s CLI integration happens to be the one that breaks your site – perhaps there’s a way to disable the plugin just during CLI requests? I fear your environment will run into more problems eventually though, given WP CLI’s minimum requirements.

    This specific issue only affect my “legacy” environment, where we’re still using an older version of WP-CLI for that very reason…

    I’d argue that if the rest of your plugin only requires PHP 5.2, that this component should also only require PHP 5.2 (independent of the version requirement for other software, such as the CLI). Especially since, at first glance, it looks like the only issue is the new-style array constructor. That said, I certainly understand where you’re coming from. And I’d be on your side if this didn’t affect me personally 🙂

    There is a workaround – wp --skip-plugins foo will run just fine in most cases (excepting those cases where a plugin implements its own CLI-specific features, like this one does). Means I’ll have to update some scripts, which is certainly annoying but not THAT annoying.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP version issue with WP-CLI support’ is closed to new replies.