Edit report at https://bugs.php.net/bug.php?id=63170&edit=1
ID: 63170
Comment by: alan dot klestoff at gmail dot com
Reported by: keirlavelle1 at hotmail dot co dot uk
Summary: Creating Socket returns a 'false' stream on local
network
Status: Open
Type: Bug
Package: Streams related
PHP Version: 5.3.17
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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