php / php/php-src

PHP does not hide command line arguments

Open
#12,134 2 comments 1 reaction 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.