filter_input() ignores $_SERVER['argv'] in cli mode
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
The following code:
<?php
var_dump(filter_input(INPUT_SERVER, 'argv'));
when called in a shell in this way:
php index.php
resulted in this output:
NULL
But I expected this output instead:
array(1) {
[0]=>
string(9) "index.php"
}
Or put another way, filter_input(INPUT_SERVER, 'argv') and $_SERVER['argv'] are not working on the same data.
PHP Version
PHP 8.1.2-1ubuntu2.10 (Ubuntu 22.04) and PHP 8.2.1 (Docker)
Operating System
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the shown filter_input(INPUT_SERVER, 'argv') snippet in CLI mode using php index.php, then trace the filter_input handling for INPUT_SERVER and compare it with $_SERVER['argv']. Done means the filtered result reflects the same argv data and the behavior is covered by an appropriate regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, php
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100