php / php/php-src

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

未关闭
#10,480 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Bug Extension: filter Status: Needs Triage
主要语言
C
星标
40.4k
派生
8.2k
平均合并
2 天 13 小时
30 天内合并 PR
96

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用 php index.php 在 CLI 模式下通过所示的 filter_input(INPUT_SERVER, 'argv') 代码片段重现该问题,然后跟踪 filter_input 对 INPUT_SERVER 的处理,并将其与 $_SERVER['argv'] 进行比较。完成的标准是:过滤后的结果反映相同的 argv 数据,并且该行为由适当的回归测试覆盖。

由索引模型根据 Issue 内容生成。

评估

技术栈
c, php
领域
cli
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。