Comments (18)
When I undo the last patch and replace:
$process = Process::fromShellCommandline($command);
With:
$process = new Process($command);
The script works again..
from image-optimize-command.
thank you opicron!
$process = new Process($command);
from image-optimize-command.
Solution found: Install wp cli via composer
instead of phar.
This is because phar bundles with symfony/process
v2 and v2 is always loaded (even though a newer version of it is installed).
Using composer
resolve the issue.
For those using Trellis, check out https://github.com/ItinerisLtd/trellis_install_wp_cli_via_composer
Re-open this issue if you have a better solution.
from image-optimize-command.
Although I see Installing symfony/process (v4.2.3)
, can you confirm symfony/process v4.2.3
is loaded?
Related:
Tips:
WP CLI doesn't provide easy way to check it. My suggestion would be looking into your wp package path
. You will find the underlying composer installation there.
from image-optimize-command.
I am unsure how to check if the symfony/process is loaded. However checking the /vendor/symfony/process/ path the php scripts are installed.
Running the install command an second time gives no warnings or errors. I assume the correct version is installed.
EDIT: The process component Changlog states 4.2.0.
I manually downloaded symfony/process 4.2.3 and replaced the old version. I uploaded an new image and tried to optimize it but it fails with the same error.
from image-optimize-command.
This is still a valid error :(
But can be fixed with changes from above.
from image-optimize-command.
Error is still valid. The fix proposed by @opicron works well. Is it possible du push it in the branch for future users?
from image-optimize-command.
Hi guys
I bumped into the same error as you
could you please detail what changes have you made ?
When I undo the last patch and replace:
$process = Process::fromShellCommandline($command);
With:
$process = new Process($command);
The script works again..
what last patch, and what file have you edited ?
Thank's
EDIT
the file to edit is
/.wp-cli/packages/vendor/spatie/image-optimizer/src/OptimizerChain.php:97
It works indeed, but I haven't "downgraded to last patch (which is ?)
from image-optimize-command.
I hade same error, after replace with @opicron suggestions everything is working fine
Thank you @jbonlinea for directing us to the file 👍
from image-optimize-command.
Which version you installed?
Is it 482d9c9 ?
from image-optimize-command.
Which version you installed?
Is it 482d9c9 ?
You mean on composer.json?
How to check version?
from image-optimize-command.
Finally found the issue - wp cli phar bundles symfony/process
v2 which got loaded no matter which versions we specified in our (and our dependencies') composer.json.
Solution to be investigated. Leave a comment if you have any suggestions.
from image-optimize-command.
more info:
$ wp shell
wp> $reflector = new \ReflectionClass('Symfony\Component\Process\Process');
=> object(ReflectionClass)#2801 (1) {
["name"]=>
string(33) "Symfony\Component\Process\Process"
}
wp> echo $reflector->getFileName();
phar:///usr/bin/wp/vendor/symfony/process/Process.php
wp>
from image-optimize-command.
spatie/image-optimizer requires symfony/process ^4.2|^5.0.
WP CLI bundle installs symfony/process v2.8.52.
Conclusion: WP CLI bundle won't work. Install WP CLI via composer instead. See: requirements
from image-optimize-command.
When I undo the last patch and replace:
$process = Process::fromShellCommandline($command);
With:
$process = new Process($command);
The script works again..
Step by step for others who don't know
nano /root/.wp-cli/packages/vendor/spatie/image-optimizer/src/OptimizerChain.php
CTRL + W and paste this Process::fromShellCommandline($command) and press enter
changer it with new Process($command)
from image-optimize-command.
Don't do that.
Install WP CLI via composer instead. See: requirements
from image-optimize-command.
Don't do that.
Install WP CLI via composer instead. See: requirements
I've tried that but didn't fix the problem for me.
from image-optimize-command.
Editing vendor code won't work neither.
Send bug report if you are facing the same issue with wp cli installed via composer.
from image-optimize-command.
Related Issues (20)
- Suggest to regenerate thunmbnails after restoring
- Readme: Clarify WP-CLI has to be installed via `composer`
- PHP Fatal error: Uncaught Symfony\Component\Process\Exception\RuntimeException: The process has been signaled with signal "11". HOT 3
- Dependabot needs permission to see mockery
- Fix CircleCI
- Dependabot needs permission to see phpcodesniffer-composer-installer
- Dependabot needs permission to see event-dispatcher
- Dependabot needs permission to see Codeception
- Dependabot needs permission to see phpunit-wrapper
- Dependabot needs permission to see phpcodesniffer-composer-installer
- Dependabot needs permission to see php-cli-tools
- Dependabot needs permission to see php-cli-tools
- How to delete backup images HOT 1
- Dependabot needs permission to see log
- SSL certificate problem: certificate has expired HOT 3
- Uncaught Error: Call to undefined method fromShellCommandline() HOT 1
- Installing issue when vhost run on php 7.4 but main server php version is 8 or above HOT 1
- Support webp
- Skip backup file HOT 2
- Normalize hooks (actions & filters) names
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from image-optimize-command.