|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63229 filter_var just hangs up
Submitted: 2012-10-06 11:32 UTC Modified: 2012-10-06 12:38 UTC
From: shabbirbhimani at gmail dot com Assigned:
Status: Not a bug Package: filter (PECL)
PHP Version: 5.3.17 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: shabbirbhimani at gmail dot com
New email:
PHP Version: OS:


 [2012-10-06 11:32 UTC] shabbirbhimani at gmail dot com
From manual page:

When we are behind a web proxy the filter_var just does not return and just ends. To test I am using the web proxy port 3128

And when I run the test script output is

start > x_fwded_4 > filtering

where as expected output should be returning value from the function filter_var anything from the function and control should progress further.

Test script:

echo 'start';
echo ' > x_fwded_4';
else if (isset($_SERVER['HTTP_CLIENT_IP']))
echo ' > client_ip';
else if (isset($_SERVER['HTTP_FROM']))
echo ' > from';
$ip = $_SERVER['HTTP_FROM'];
echo ' > remote';
echo ' > filtering';
filter_var($ip, FILTER_VALIDATE_IP);
echo ' > end';

Expected result:
filter_var function should return and not die or exit.

Actual result:
start > x_fwded_4 > filtering


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-06 11:39 UTC]
pls try only:

filter_var($ip, FILTER_VALIDATE_IP);

set the value of $ip set to what you use.

I can't reproduce any blocking issue or whatever else closed to that.
 [2012-10-06 11:39 UTC]
-Status: Open +Status: Feedback
 [2012-10-06 11:45 UTC] shabbirbhimani at gmail dot com
Even the $ip = ''; which is my IP reproduces the same.

You can see the script in action here

I have added phpinfo at the end and let me know if you are able to see it or not?
 [2012-10-06 11:45 UTC] shabbirbhimani at gmail dot com
-Status: Feedback +Status: Open
 [2012-10-06 12:05 UTC]
-Status: Open +Status: Feedback
 [2012-10-06 12:05 UTC]
Try using CLI in a console:

php 63229.php

nothing in filter has something to do with network connection.
 [2012-10-06 12:37 UTC] shabbirbhimani at gmail dot com
-Status: Feedback +Status: Open
 [2012-10-06 12:37 UTC] shabbirbhimani at gmail dot com
The issue occurs when you are behind a proxy. Also FILTER is not blank and even adding Option like FILTER_NULL_ON_FAILURE does not help either.
 [2012-10-06 12:38 UTC]
Nothing to do with PHP's filter var, sorry.

If you give a one line script using only a constant string with the IP and you can 
reproduce a problem in CLI, then please reopen this bug.
 [2012-10-06 12:38 UTC]
-Status: Open +Status: Not a bug
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Dec 04 21:03:34 2021 UTC