php / php/php-src

filter_input() ignores $_SERVER['argv'] in cli mode

Open
#10,480 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Extension: filter Status: Needs Triage
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

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

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.