K
K
Kirill_Ulyanov2017-02-23 19:05:51
PHP
Kirill_Ulyanov, 2017-02-23 19:05:51

How to fix the bug that filter_input() for INPUT_SERVER returns NULL?

I act according to the official documentation: php.net/manual/en/function.filter-input.php
The following code always returns NULL:

<?php
var_dump(filter_input(INPUT_SERVER, "REMOTE_ADDR", FILTER_VALIDATE_IP);
?>

I found information that this is a bug, and quite old: https://bugs.php.net/bug.php?id=49184
However, I did not find information on how to solve this problem.
Perhaps someone knows how to solve this problem?
Debian GNU/Linux 7.11 (wheezy)
Apache/2.2.22 (Debian)
PHP 5.6.30 в режиме CGI

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Kirill_Ulyanov, 2017-09-01
@Kirill_Ulyanov

The problem can be solved by stopping using PHP in CGI mode.
This is a bug (I will not provide a link).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question