php.net |  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
Votes:1
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-09-30 06:32 UTC] 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.
 [2014-04-03 09:44 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2014-04-03 09:44 UTC] mike@php.net
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


 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Oct 20 03:01:26 2019 UTC