|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49257 stream_socket_enable_crypto() problems outside of child process
Submitted: 2009-08-14 17:40 UTC Modified: 2009-09-02 19:24 UTC
From: jerrywilborn at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.10 OS: CentOS 4.4
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: jerrywilborn at gmail dot com
New email:
PHP Version: OS:


 [2009-08-14 17:40 UTC] jerrywilborn at gmail dot com
Open a tcp connection using stream_socket_client, spawn a child process 
with pcntl_fork, encrypt the stream in the child, fetch data from the 
stream.  In the parent wait for the child to finish and then fetch data 
out of the stream; it is not decrypted.

Reproduce code:

$s = stream_socket_client("tcp://", $errno, $errstr, 5, STREAM_CLIENT_CONNECT);

if (!pcntl_fork()) {
	if (stream_socket_enable_crypto($s, TRUE, STREAM_CRYPTO_METHOD_SSLv23_CLIENT)) {
		print "child: " . fgets($s);

print "parent: " . fgets($s) . "\n";


Expected result:
child: 220 ESMTP
parent: 220 ESMTP

Actual result:
child: 220 ESMTP
parent:  ??1)?????cV^~?????


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-09-02 19:20 UTC]
Exactly why would it be? You forked and called the crypto enabling, you 
didn't enable it for the parent. 
 [2009-09-02 19:24 UTC] jerrywilborn at gmail dot com
I assumed the encryption was a feature of the socket and not the 
process. Thanks for the clarification.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 28 08:01:29 2024 UTC