• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

error wpcli wp-toolkit

fferraro87

Basic Pleskian
Hi,

i'm trying to use wp cli in order to update wp core and themes so i do that command :

Code:
plesk ext wp-toolkit --wp-cli -instance-id 13 -- theme update --all

but i've that error :

Code:
Parse error: syntax error, unexpected '.', expecting '&' or variable (T_VARIABLE) in /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/polyfills/WP_CLI/UpgraderSkin.php on line 34

How can i fix this? there is a way to update wp toolkit?
i've installed Plesk Version 18.0.21 Update #4 on a CentOS Linux 7.7.1908

Thanks
 
I believe the wp-cli package only supports PHP 5.4 and up, so the version of wp-cli in wp-toolkit was modified by adding the UpgraderSkin “polyfill” for PHP 5.3 compatibility. That’s even what the comment on the polyfill class states: “Backport for compatibility with wordpress 5.3.”

Besides this comment, the only other difference between the polyfill and the class that is actually part of the wp-cli package at version 1.4 is how the feedback method handles additional arguments:

8,9d7
< * Backport for compatibility with wordpress 5.3
< *
34c32
< public function feedback( $string, ...$args ) {
---
> public function feedback( $string ) {
44a43,44
> $args = func_get_args();
> $args = array_splice( $args, 1 );


Ironically, the splat operator was only introduced in 5.6, which means that this polyfill is no longer compatible with 5.3, which is seemingly the only reason the polyfill was created. Further, the change appears to be unnecessary, because it effectively it does the same thing only with a newer feature. My guess is that this change was introduced around December 6.

The toolkit is invoked with a php7 binary, but my assumption is that it invokes certain scripts with a binary that is the same version any given site is running. Hence, toolkit will encounter this problem with any site running on php 5.5 or older.

My assumption is that wp-toolkit looks for a polyfill class and, if one exists, uses it in place of the matching vendor class. So because the polyfill appears to be unnecessary, I just renamed

/usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/polyfills/WP_CLI/UpgraderSkin.php

to

/usr/local/psa/admin/plib/modules/wp-toolkit/vendor/wp-cli/wp-cli/php/polyfills/WP_CLI/UpgraderSkin.php.bak

and now it appears that the actual vendor file is used and the polyfill is ignored, as the error has disappeared. Hopefully this is fixed in the next wp-toolkit update.

Now of course all these sites should be updated to use php 7 or newer — I get that, but in my case it’s just not going to happen.
 
Newer versions of WordPress require newer php versions. This polyfill is required for compatibility with the new version of WordPress. There is no way back, this is caused by a change in the method signatures in the wordpress itself:

Code Modernisation: Introduce the spread operator in `wp-admin/includ… · WordPress/WordPress@340b7b5

If the version of your WordPress is less than 5.3, you can delete this polyfill (but when updating wp-toolkit extension it will appear again)
Or use php version 5.6 (or higher) on this domain, which is also required by the new version of WordPress.
 
Back
Top