php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #419 fsockopen() doesn't return meaningful error codes
Submitted: 1998-05-30 11:42 UTC Modified: 1998-05-30 18:24 UTC
From: explorer-php3 at flame dot org Assigned: rasmus (profile)
Status: Closed Package: Misbehaving function
PHP Version: 3.0 Latest CVS OS: NetBSD/i386-1.3.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: explorer-php3 at flame dot org
New email:
PHP Version: OS:

 

 [1998-05-30 11:42 UTC] explorer-php3 at flame dot org
fsockopen() doesn't return meaningful error codes, so there is no way to
tell the difference between, say, "connection refused" and "connection
timed out"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-05-30 18:24 UTC] rasmus
Ok, this has been cleaned up.  fsockopen() now returns FALSE like all the other PHP functions on a failure, but in order to get useful information from a failure you can now pass in two optional arguments (by reference).

ie.

  fsockopen($ip,$port,&$errno,&$errstr)

These will be set to the errno and error string that come back from the system-level connect() call.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri May 09 21:01:27 2025 UTC