Bug #63170 [Opn->Nab]: Creating Socket returns a 'false' stream on local network

From: Date: Thu, 03 Apr 2014 09:44:47 +0000
Subject: Bug #63170 [Opn->Nab]: Creating Socket returns a 'false' stream on local network
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185059@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63170&edit=1

 ID:                 63170
 Updated by:         mike@php.net
 Reported by:        keirlavelle1 at hotmail dot co dot uk
 Summary:            Creating Socket returns a 'false' stream on local
                     network
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Streams related
 PHP Version:        5.3.17
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php




Previous Comments:
------------------------------------------------------------------------
[2012-09-30 06:32:59] alan dot klestoff at gmail dot com

As we can see in documantation http://php.net/fsockopen

> Warning
> UDP sockets will sometimes appear to have opened without an error, 
> even if the  remote host is unreachable. The error will only become
> apparent when you read  or write data to/from the socket. The reason
> for this is because UDP is a "connectionless" protocol, which means 
> that the operating system does not try to establish a link 
> for the socket until it actually needs to send or receive data.

------------------------------------------------------------------------
[2012-09-27 10:41:50] keirlavelle1 at hotmail dot co dot uk

Description:
------------
When using fsockopen if the ip address specified for hostname is local and within the subnet mask
range, and UDP is specified as the transport method, the returned handle will var_dump as a resource
of type stream, even if the ip address doesn't exist on the network - indicating a false
positive for some reason.

Test script:
---------------
$socket = fsockopen('UDP://192.168.213.23:12345', $errno, $errstr, 30);

//assuming that subnet mask is 255.255.255.0 - port can be anything

var_dump($socket);

Expected result:
----------------
bool(false);

//possibly e_warning that domain is not valid

Actual result:
--------------
resource(8) of type (stream)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63170&edit=1


Thread (3 messages)

« previous php.bugs (#185059) next »