php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #52952 fsockopen() has more dependencies than listed
Submitted: 2010-09-29 16:22 UTC Modified: 2010-10-13 11:53 UTC
From: victor dot yap at alumni dot concordia dot ca Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Linux
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: victor dot yap at alumni dot concordia dot ca
New email:
PHP Version: OS:

 

 [2010-09-29 16:22 UTC] victor dot yap at alumni dot concordia dot ca
Description:
------------
The manual entry for fsockopen() claims this overly simple dependency:

"If you have compiled in OpenSSL support, you may prefix the hostname with either ssl://  or tls:// to use an SSL or TLS client connection over TCP/IP to connect to the remote host."

However, it will be worth adding a note to point out that "/dev/urandom" is also required, especially setting up chroot'd environments.  From what I've dug up briefly, any "/dev/*random" is also acceptable.

The error messages given by fsockopen() could also be improved.

We experienced a 2 hour development blockage trying to assert that "OpenSSL support" was in fact compiled in... when the root of our problems was simply needing to provide a "/dev/urandom" within the chroot environment.

Test script:
---------------
// As demonstrated in https://cms.paypal.com/cms_content/US/en_US/files/developer/IPN_PHP_41.txt (retrieved 2010-09-29)

$fp = fsockopen ('ssl://www.paypal.com', 443, $errno, $errstr, 30);


Expected result:
----------------
While a "/dev/urandom" was our missing link, I'd hope that the documentation will be more thorough and clarify any other potential dependencies that are getting chained along by virtue of OpenSSL.

Maybe something along the lines of "In addition to compiled-in support of OpenSSL, your operating environment also needs to support OpenSSL (for example: on *nix systems, ensuring that '/dev/*random' is available for producing random numbers)."

The error/warning/notice message that fsockopen() prints out should try to be more clear about why the "ssl://" protocol was not available, mostly to cover this case:

- Was there a failure to leverage OpenSSL, even if compiled support is available? The message should then clarify "OpenSSL support has been compiled-in, but cannot be invoked...[because?]"

If possible, give even more information:
"/dev/*random is unavailable"



Actual result:
--------------
Without /dev/urandom functioning in our chroot'd environment,

fsockopen() prints out some less-than-helpful message about the transport protocol not being available, even though "compiled-in" support was there.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-13 11:37 UTC] aharvey@php.net
-Status: Open +Status: Assigned -Package: Sockets related +Package: Documentation problem -Assigned To: +Assigned To: aharvey
 [2010-10-13 11:37 UTC] aharvey@php.net
In terms of the error message, PHP is pretty much repeating whatever OpenSSL gives it, unfortunately.

As for the documentation, I'm not terribly keen to start including a list of extra OpenSSL dependencies in each place where the manual says that something works if SSL support is enabled. What I'll do instead is update the OpenSSL installation chapter to include a note about the /dev/*random dependency and update the fsockopen() page (and any others with the same sort of construct) to change the wording of "compiled in" to imply that OpenSSL support also has to be working, beyond simply being included in the binary.
 [2010-10-13 11:53 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=304369
Log: Fix doc bug #52952 (fsockopen() has more dependencies than listed).
 [2010-10-13 11:53 UTC] aharvey@php.net
-Status: Assigned +Status: Closed
 [2010-10-13 11:53 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 07:00:01 2026 UTC