From:             admin at php2tor dot com
Operating system: Fedora Core 1
PHP version:      4.3.8
PHP Bug Type:     Network related
Bug description:  Fsockopen function working incorrectly?

Description:
------------
I'm using Fedora Core 1 and PHP 4.3.8

I'm using the fsockopen function to check status of port for a windows
environment. I'm going thru the WAN to check this port which is two hops
away. For some reason I had a routing issue to the destination network. I
tried to ping the server from my windows workstation and I would get reply
from the router (as opposed to just getting a request timeout message)
saying the destination network was unavailable. Anyway, when I ran the
script that checks the server (from the fedora machine), the php script
would report the server as up, when in reality it couldn't be reached.

I'm guessing cause the router respoded with reply messages that the
fsockopen function assumes a connection is made? 

Reproduce code:
---------------
$host = '192.168.1.1';
$port = '445';
$timeout = '2';

$fp = fsockopen($host, $port, $errno. $errstr, $timeout);

if ($fp)
{
    print 'server_up.gif';

}else{

  print 'server_down.gif';

}









Expected result:
----------------
Should show the host is not reachable and print "the device is down".

Actual result:
--------------
given the conditions mentioned above, the server should show down, but the
fsockopen says its up.

-- 
Edit bug report at http://bugs.php.net/?id=29576&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29576&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29576&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29576&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29576&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29576&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29576&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29576&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29576&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29576&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29576&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29576&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29576&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29576&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29576&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29576&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29576&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29576&r=float

Reply via email to