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: 2021-08-08 04:22 UTC
From: scott dot nebor at eigendev dot com Assigned: cmb (profile)
Status: No Feedback 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:
 [2021-07-28 11:06 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-07-28 11:06 UTC] cmb@php.net
I think that regression had been introduced by a commit which
restored BC with versions prior to PHP 5.6.0[1].  So in PHP 5.6.6,
tls supported TLS 1.0, 1.1 and 1.2, but in PHP 5.6.7 it only
supported TLS 1.0.

Anyhow, is that still an issue with any of the actively supported
PHP versions[2]?

[1] <https://github.com/php/php-src/commit/10bc5fd4c4c8e1dd57bd911b086e9872a56300a0>
[2] <https://www.php.net/supported-versions.php>
 [2021-07-28 11:06 UTC] cmb@php.net
I think that regression had been introduced by a commit which
restored BC with versions prior to PHP 5.6.0[1].  So in PHP 5.6.6,
tls supported TLS 1.0, 1.1 and 1.2, but in PHP 5.6.7 it only
supported TLS 1.0.

Anyhow, is that still an issue with any of the actively supported
PHP versions[2]?

[1] <https://github.com/php/php-src/commit/10bc5fd4c4c8e1dd57bd911b086e9872a56300a0>
[2] <https://www.php.net/supported-versions.php>
 [2021-08-08 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 08:01:27 2024 UTC