emmtre
August 2, 2023, 2:10pm
41
austinwendt:
One more update here - new PHP 8.2 binaries are out that include bundled Imagick for:
macOS (Intel)
macOS (Apple Silicon)
Linux
No Imagick for Windows yet - we’re learning that this is a wider WordPress problem, as the community no longer builds Windows binaries for Imagick by default
@austinwendt Do we need Local 7.1.2 to be able to download the latest PHP 8.2 binaries? I have php-8.2.8+0 installed but I don’t see any update button?
If you go to ~/Library/Local/lightning-services/
and remove the current php8.2, you will be asked to download it again. This provides the newer version 8.2.8+1.
I realize this isn’t the easiest way to accomplish this. I’ve had a non-functional ‘Update’ link next to PHP 8.2.8 on Local 7.1.0.
emmtre
August 2, 2023, 6:36pm
43
@afragen Yeah, I know but I noticed in the release notes for the Local 7.1.2 beta that this has been resolved.
emmtre
August 3, 2023, 9:09am
44
@adamperry @austinwendt Bummer that your pull request was rejected due to problems with esc_cmd()
.
opened 03:50PM - 21 Jul 23 UTC
bug
command:cli-update
## Bug Report
--- ✅ If you are in the correct location now... --->
- [x] Y… es, I reviewed the [contribution guidelines](https://make.wordpress.org/cli/handbook/contributing/).
- [x] Yes, more specifically, I reviewed the guidelines on [how to write clear bug reports](https://make.wordpress.org/cli/handbook/bug-reports/).
**Describe the current, buggy behavior**
On macOS, at least, the `wp cli update` command fails when the path to the PHP binary running wp-cli (i.e. the value of `PHP_BINARY` when running the phar - see `Utils\get_php_binary()`) has a space in it. For our app, we give the option to download different versions of PHP, and we store those binaries in the `Application Support` folder. When a user is running wp-cli using any of those downloaded versions, the update will fail. However, it doesn't fail when they run the update command from our bundled version of PHP, which lives at a location without spaces in the path.
**Describe how other contributors can replicate this bug**
- Move the PHP binary to a location with a space in the path.
- Add it to `$PATH` and run an older version of wp-cli with it
- Run `wp cli update` and watch the command fail, saying the location doesn't exist, with the path given ending at the space.
**Describe what you expect as the correct outcome**
I expect the `wp cli update` command to succeed regardless of where the PHP binaries being used live.
**Let us know what environment you are running this on**
```
OS: Darwin 22.5.0 Darwin Kernel Version 22.5.0: Thu Jun 8 22:22:22 PDT 2023; root:xnu-8796.121.3~7/RELEASE_X86_64 x86_64
Shell: /bin/zsh
PHP binary: /Users/adam.perry/Library/Application Support/Local/lightning-services/php-8.0.22+6/bin/darwin/bin/php
PHP version: 8.0.22
php.ini used: /Users/adam.perry/Library/Application Support/Local/run/CiJoccyP_/conf/php/php.ini
MySQL binary: /Users/adam.perry/dev/local/flywheel-local/extraResources/lightning-services/mysql-8.0.16+6/bin/darwin/bin/mysql
MySQL version: mysql Ver 8.0.16 for macos10.14 on x86_64 (MySQL Community Server - GPL)
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /Users/adam.perry/Local Sites/vernacom/app/public
WP-CLI packages dir:
WP-CLI cache dir: /Users/adam.perry/.wp-cli/cache
WP-CLI global config: /Users/adam.perry/dev/local/flywheel-local/extraResources/bin/wp-cli/config.yaml
WP-CLI project config:
WP-CLI version: 2.7.1
```
**Provide a possible solution**
In `CLI_Command.php > CLI_Command > update`, change:
```php
$php_binary = Utils\get_php_binary();
```
to
```php
$php_binary = escapeshellarg(Utils\get_php_binary());
```
DIFF:
```diff
diff --git a/php/commands/src/CLI_Command.php b/php/commands/src/CLI_Command.php
index 9ed7e080..09b3e1ec 100644
--- a/php/commands/src/CLI_Command.php
+++ b/php/commands/src/CLI_Command.php
@@ -356,7 +356,7 @@ class CLI_Command extends WP_CLI_Command {
}
$allow_root = WP_CLI::get_runner()->config['allow-root'] ? '--allow-root' : '';
- $php_binary = Utils\get_php_binary();
+ $php_binary =escapeshellarg( Utils\get_php_binary());
$process = Process::create( "{$php_binary} $temp --info {$allow_root}" );
$result = $process->run();
if ( 0 !== $result->return_code || false === stripos( $result->stdout, 'WP-CLI version' ) ) {
```
**Provide additional context/screenshots**
<img width="809" alt="Screenshot 2023-07-21 at 10 39 47 AM" src="https://github.com/wp-cli/wp-cli/assets/62191853/346e2dc2-d7a0-48a0-8b18-f0bd5b8700c8">
Hey @emmtre - are you on Apple Silicon? Were you able to get this resolved?
Hi all - I’m going to move this to our Resolved Feature Requests category as PHP 8.2 is available for all operating systems.
The new automation is working well! So well that versions like PHP 8.2.10 and PHP 8.1.23 are already available in Local - less than 2 weeks is much better than we’ve averaged historically
@emmtre I owe you a response about WP-CLI in another thread, but I will follow up with you.
2 Likes
arecian
September 15, 2023, 7:22pm
47
Thanks @austinwendt ! It is great to have them available so quickly!
Any word on PHP 8.3 availability since it’s due for release in November?
@arecian you bet, we’re glad too!
PHP 8.3 RC 2 came out yesterday, it looks like. The way our automation is configured, as soon as it is marked as officially supported (we pull from their API), it will enter our pipeline and binaries will be generated. We’ll do some quick tests to make sure nothing looks broken and then mark them as available for testing! By marking them available, this means they’ll start appearing in the dropdown inside Local.
3 Likes
emmtre
September 16, 2023, 12:47pm
49
austinwendt:
Hi all - I’m going to move this to our Resolved Feature Requests category as PHP 8.2 is available for all operating systems.
The new automation is working well! So well that versions like PHP 8.2.10 and PHP 8.1.23 are already available in Local - less than 2 weeks is much better than we’ve averaged historically
Yes the new automation is a big step forward. Congrats to the entire team who made this possible.
4 Likes
system
Closed
December 15, 2023, 12:47pm
50
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
Nick-B
December 19, 2023, 10:06pm
51
Following up here for @arecian and anyone else since there was a lot of discussion around PHP releases in this thread. Our new automation workflow for PHP rollouts has worked very well. The latest Local release is out now and includes PHP 8.3 for those interested. Happy Developing
2 Likes