Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.php > #3298

Re: $_SERVER vs filter_input_array(INPUT_SERVER)

From "J.O. Aho" <user@example.net>
Newsgroups alt.php
Subject Re: $_SERVER vs filter_input_array(INPUT_SERVER)
Date 2024-04-09 13:54 +0200
Message-ID <l7koiqFfhh0U1@mid.individual.net> (permalink)
References <uv36qm$10r00$2@news.icm.edu.pl>

Show all headers | View raw


On 09/04/2024 12.55, Jakub wrote:

> The result is almost the same.
> But $_SERVER give to access to this keys:
> REQUEST_TIME_FLOAT and REQUEST_TIME
> but filter_input_array(INPUT_SERVER)
> don't have these keys.

If I haven't understood things wrong, the source data the both have is 
the same, but there are some values which are added on at a bit later 
stage to $_SERVER and $_ENV which makes some of the values to not exists 
in the filter_input_array(INPUT_SERVER)/filter_input_array(INPUT_ENV).


> How to fix this problem?

You take them from $_SERVER

You can also still filter the values:
var_export(filter_var($_SERVER['REQUEST_TIME'], FILTER_VALIDATE_INT));

var_export(filter_var($_SERVER['REQUEST_TIME_FLOAT'], 
FILTER_VALIDATE_FLOAT));

-- 
  //Aho

Back to alt.php | PreviousPrevious in thread | Find similar


Thread

$_SERVER vs filter_input_array(INPUT_SERVER) Jakub <jak74@interia.pl> - 2024-04-09 12:55 +0200
  Re: $_SERVER vs filter_input_array(INPUT_SERVER) "J.O. Aho" <user@example.net> - 2024-04-09 13:54 +0200

csiph-web