PHP does not hide command line arguments
Open
Nobody has claimed this yet.
Bug
Status: Needs Triage
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
Description
Description
Run php-cli with argument -H, then check process list:
php -H -e & ps ax
Expected ps output (command line arguments vanished):
...
13088 pts/2 R 0:00 php
...
Actual ps output:
...
13088 pts/2 R 0:00 php -H -e
...
The problem is that this fragment of code works not on original argv, but on argv that was modified by save_ps_args:
/*
* Do not move this initialization. It needs to happen before argv is used
* in any way.
*/
argv = save_ps_args(argc, argv);
PHP Version
PHP 8.2.10
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
Start in sapi/cli/php_cli.c around line 949 and inspect how save_ps_args changes argv before the argument-hiding logic runs. Reproduce the issue with php -H -e & ps ax, then verify that the process listing shows only php without its command-line arguments.
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
- Clearly specified
- Newbie friendliness
- 45/100