-
Notifications
You must be signed in to change notification settings - Fork 86
Conversation
In some cases $argv[0] can be empty and strpos will throw an "Empty needle" error. Therefore on line 493 $argv should be checked, that it is not empty and a string, instead of just checking its existence with isset(). Someone tried to attack one of my websites with "/index.php?++++hot=1&++++kw=%E8%93%9D%E7%89%99%E8%80%B3%E6%9C%BA&r=l" and this request caused an exception which was logged and where I found the error.
Hi @eweso, thanks for your contribution. I've checked it quickly and it looks like you have enabled I've changed my configuration, tried the request you provided and the results of
so yeah - Looking at the code, I don't think that we should really process We are detecting there the base url, so it cannot be detected from query string. I would suggest to change your PHP configuration, unless you really need to use somewhere _SERVER['argv'] for GET requests. |
As I said in previous comment - we don't really want process argv, as for GET requests it contains query string only - so we shouldn't use it for script filename. It should be used only in CLI mode. Can't see a nice way to test it for GET request, for CLI test is in place already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚢
$filename = substr($filename, strlen($argv[0])); | ||
// Only for CLI requests argv[0] contains script filename | ||
// @see https://www.php.net/manual/en/reserved.variables.server.php | ||
if (PHP_SAPI === 'cli') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 This makes sense; only test argv if we're in a CLI request.
We try to detect the script file name only if argv[0] is set and is non empty string.
Thanks, @eweso! |
In some cases $argv[0] can be empty and strpos will throw an "Empty needle" error. Therefore on line 493 $argv should be checked, that it is not empty and a string, instead of just checking its existence with isset().
Someone tried to attack one of my websites with "/index.php?++++hot=1&++++kw=%E8%93%9D%E7%89%99%E8%80%B3%E6%9C%BA&r=l" and this request caused an exception which was logged and where I found the error.
Provide a narrative description of what you are trying to accomplish:
Are you fixing a bug?
master
branch, and submit against that branch.CHANGELOG.md
entry for the fix.Are you creating a new feature?
develop
branch, and submit against that branch.CHANGELOG.md
entry for the new feature.Is this related to quality assurance?
Is this related to documentation?