-
-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error when calling shell script from browser #2674
Conversation
Why not
|
122569c
to
bdfbe0c
Compare
Okay, maybe a bit more readable. I updated my PR. I changed |
I am not sure empty is correct. What about a custom shell script that extends the abstract class, but has no arguments? edit: maybe not actually a problem since the script name is in argv as well IIRC. |
@justinbeaty I created a script and the run() method works correctly also with this patch, so I think the "empty" is not a problem in this context |
but actually... htaccess forbids to call shell/*.php from browser... so do we need this? |
I read it more carefully and see that it wouldn't cause any problems. Regarding htaccess, I suppose it still doesn't hurt in case someone has a misconfigured server. |
merged and cherrypicked to v20 |
Description (*)
Running a shell script from browser may cause the PHP warning
Undefined array key "argv"
. This happens because shell/abstract.php tries to read$_SERVER['argv']
without checking if it exists.$_SERVER['argv']
is not set when a script is run from browser.I know running a shell script from browser doesn't make much sense and trying it will result in the message
This script cannot be run from Browser. This is the shell script.
. But nonetheless, the script should exit gracefully and not trigger a PHP warning.Manual testing scenarios (*)
Contribution checklist (*)