|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #63170 Creating Socket returns a 'false' stream on local network
Submitted: 2012-09-27 10:41 UTC Modified: 2014-04-03 09:44 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: keirlavelle1 at hotmail dot co dot uk Assigned:
Status: Not a bug Package: Streams related
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: keirlavelle1 at hotmail dot co dot uk
New email:
PHP Version: OS:


 [2012-09-27 10:41 UTC] keirlavelle1 at hotmail dot co dot uk
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://', $errno, $errstr, 30);

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


Expected result:

//possibly e_warning that domain is not valid

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-30 06:32 UTC] alan dot klestoff at gmail dot com
As we can see in documantation

> 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.
 [2014-04-03 09:44 UTC]
-Status: Open +Status: Not a bug
 [2014-04-03 09:44 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 20:01:26 2023 UTC