php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-04-21 11:26 UTC] scott dot nebor at eigendev dot com
Description:
------------
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);
$myhost='myhost';
$myport='12345';
$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);



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-16 07:13 UTC] mike@php.net
-Assigned To: +Assigned To: rdlowrey
 [2015-07-16 07:13 UTC] mike@php.net
Daniel, haven't there been changes to how the proto:// part is interpreted?
 [2017-10-24 06:20 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: rdlowrey +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 21:01:42 2019 UTC