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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
48 - 37 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 05:01:28 2024 UTC