php / php/php-src

REQUEST_TIME/REQUEST_TIME_FLOAT missing in INPUT_SERVER

未关闭
#17,543 13 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

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

描述

Description

The following code:

<?php

if ( php_sapi_name() === 'cli' ) {
    echo "filter_input does not work in PHP CLI";
    exit;
}

var_dump( filter_input( INPUT_SERVER, 'REQUEST_TIME_FLOAT' ) );
var_dump( $_SERVER['REQUEST_TIME_FLOAT'] );

var_dump( filter_input( INPUT_SERVER, 'REQUEST_TIME' ) );
var_dump( $_SERVER['REQUEST_TIME'] );

Resulted in this output:

NULL
float(1737560728.0001)
NULL
int(1737560728)

But I expected this output instead:

float(1737560728.0001)
float(1737560728.0001)
int(1737560728)
int(1737560728)

These are the only 2 documented in https://www.php.net/manual/en/reserved.variables.server.php with that behavior? Is this a bug?

I only encountered this behavior with other (non-documented) variables HOME and USER

PHP Version

PHP 8.4

Operating System

No response

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中的 PHP reproducer 开始,将 filter_input(INPUT_SERVER, ...) 与 REQUEST_TIME_FLOAT 和 REQUEST_TIME 对应的 $_SERVER 值进行比较。跟踪 filter_input 的 INPUT_SERVER 入口点及其对这些变量的处理;当两个调用都返回预期输出中显示的文档值时,该 issue 即完成。

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

评估

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

把新 issue 发到你的邮箱

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