rosell-dk / exec-with-fallback Goto Github PK
View Code? Open in Web Editor NEWexec() with fallback to emulations (proc_open, passthru, etc)
License: GNU General Public License v3.0
exec() with fallback to emulations (proc_open, passthru, etc)
License: GNU General Public License v3.0
Naming ideas:
Simply what it does:
The rat finds its way… And dont give up easily. Tries different ways
Eller navngiv efter Wolfe, “the fixer” i Pulp Fiction - a no nonense charactor who gets the job done (with style)
Nationality:
Material:
Other ideas:
StrongExec, ResilientExec, EmulatedExec, GoalOrientedExec, ExecContractor, ExecDeLuxe, DropInExec, BetterExec, ExecMaster, ExecDragon, CuteExec, PersistantExec, ToughExec, ExecWithFallback, AdaptableExec, CompliantExec, ImprovedExec, ResoluteExec, StautExec, ObstinateExec, KeenExec, AgileExec, Smooth, Flexible, ExecAndFriends, SturdyExex, ResilientExec
I use "&" in the @param tag for values passed by reference.
PHPstan does not like it.
But there are projects that recommends documenting this way, even though it is not in the PSR-19 draft.
https://stackoverflow.com/questions/62934920/is-there-a-phpdoc-standard-to-describe-function-attributes-passed-by-reference
I want to use it, so I should add an exception for PHPstan
It is possible (but very rare!) to configure PHP such that exec() is disabled, but it is impossible to find out from inside PHP.
We have met a system that behaved like this:
So, for these poorly setup systems, lets provide some escape hatches. To disable disable exec, one should be able to do one of the following:
define('EXEC_WITH_FALLBACK_DISABLE_ALL', true);
)We add the following in the top of our exec function:
if (defined('EXEC_WITH_FALLBACK_DISABLE_ALL') && EXEC_WITH_FALLBACK_DISABLE_EXEC) {
throw new \Exception('exec() is is disabled with EXEC_WITH_FALLBACK_DISABLE_ALL constant');
}
if (getenv('EXEC_WITH_FALLBACK_DISABLE_ALL')) {
throw new \Exception('exec() is is disabled with EXEC_WITH_FALLBACK_DISABLE_ALL environment variable');
}
Use the method I did with the image-mime-type-sniffer library
The shell_exec function is called with three parameters, even though Exec is invoked with just two. It causes it to return false.
Should we heck ini_get('disable_functions')
too?
I don't think it is needed.
However, some have been thinking that in the past.
My guess is that such issues only applies to old versions of PHP.
But I might be wrong?
https://stackoverflow.com/questions/3938120/check-if-exec-is-disabled
https://stackoverflow.com/questions/2749591/php-exec-check-if-enabled-or-disabled
https://www.py4u.net/discuss/26911
Hi @rosell-dk,
I am using the Wordpress webp-express plugin, which includes this repository.
Since version 0.25.1 the wp-cli file sum check is failing because of a missing file, which results in a failing automated deploy script.
$ which wp
/usr/local/bin/wp
$ wp plugin verify-checksums webp-express
+--------------+---------------------------------------------------+-----------------+
| plugin_name | file | message |
+--------------+---------------------------------------------------+-----------------+
| webp-express | vendor/rosell-dk/exec-with-fallback/docs/notes.md | File is missing |
+--------------+---------------------------------------------------+-----------------+
Error: No plugins verified (1 failed).
Could you add the missing file again or update the webp-express plugin accordingly, please?
There is a risk that this library will be used for malware.
And so, there is also the risk that anti malware software will associate files in this library with malware.
Is there a way we can reduce that risk?
They do it here:
https://github.com/phpstan/phpstan/actions/runs/843373676/workflow
PS: Now we are at it, take a look at this too:
https://github.com/nanasess/setup-php/blob/master/.github/workflows/workflow.yml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.