Bug #69495 [Fbk]: stream_socket_client with tls failing since 5.6.7

From: Date: Wed, 28 Jul 2021 11:06:51 +0000
Subject: Bug #69495 [Fbk]: stream_socket_client with tls failing since 5.6.7
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235432@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69495&edit=1 ID: 69495 Updated by: cmb@php.net Reported by: scott dot nebor at eigendev dot com Summary: stream_socket_client with tls failing since 5.6.7 Status: Feedback Type: Bug Package: Streams related Operating System: Ubuntu 12.04 PHP Version: 5.6.8 Assigned To: cmb Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2021-07-28 11:06:49] 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> ------------------------------------------------------------------------ [2015-07-16 07:13:49] mike@php.net Daniel, haven't there been changes to how the proto:// part is interpreted? ------------------------------------------------------------------------ [2015-04-21 11:26:44] 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); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69495&edit=1

« previous php.bugs (#235432) next »