|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69495 stream_socket_client with tls failing since 5.6.7
Submitted: 2015-04-21 11:26 UTC Modified: 2017-10-24 06:20 UTC
From: scott dot nebor at eigendev dot com Assigned:
Status: Open Package: Streams related
PHP Version: 5.6.8 OS: Ubuntu 12.04
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: scott dot nebor at eigendev dot com
New email:
PHP Version: OS:


 [2015-04-21 11:26 UTC] scott dot nebor at eigendev dot com
tls connections using stream_socket_client appear to be failing since php 5.6.7 (it's happening in both 5.6.7 and 5.6.8)

Connections are failing with the error message: "stream_socket_client(): Failed to enable crypto"

The following snippet of code works in php 5.6.6 and lower, but fails in 5.6.7/5.6.8
$contextArray['ssl']['cafile'] ='/pathtomycafile.pem'
$contextArray['ssl']['local_cert'] ='/pathtomycertfile.pem'
$contextArray['ssl']['peer_name']= 'mypeername'
$context = stream_context_create($contextArray);
$sock = stream_socket_client('tls://$myhost:$myport, $errno, $errstr, 5, STREAM_CLIENT_CONNECT, $context);

As a workaround, the stream_socket_client call can be changed to use ssl instead, which works in 5.6.6 and 5.6.7/5.6.8
$sock = stream_socket_client('ssl://$myhost:$myport, $errno, $errstr, 5, STREAM_CLIENT_CONNECT, $context);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-16 07:13 UTC]
-Assigned To: +Assigned To: rdlowrey
 [2015-07-16 07:13 UTC]
Daniel, haven't there been changes to how the proto:// part is interpreted?
 [2017-10-24 06:20 UTC]
-Status: Assigned +Status: Open -Assigned To: rdlowrey +Assigned To:
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jun 22 13:01:23 2021 UTC