diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-11-05 12:15:49 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-11-05 12:16:09 +0100 |
commit | 3e41ade638b215a1e9a5ece40ecf25485fcb9788 (patch) | |
tree | 633a7db541ae1251b776a1e6d3960a1554d916a1 | |
parent | 214f4cfadb1ce1edad21537bdcedf1cd5e145a37 (diff) | |
parent | 747cb4624493cea67eb801c342e063b3ef505295 (diff) | |
download | php-git-3e41ade638b215a1e9a5ece40ecf25485fcb9788.tar.gz |
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
Fixed bug #78775
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/curl/tests/bug78775.phpt | 34 | ||||
-rw-r--r-- | ext/openssl/xp_ssl.c | 2 |
3 files changed, 40 insertions, 0 deletions
@@ -9,6 +9,10 @@ PHP NEWS . Fixed bug #77930 (stream_copy_to_stream should use mmap more often). (Nikita) +- OpenSSL: + . Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted + connections). (Nikita) + - Reflection: . Fixed bug #78774 (ReflectionNamedType on Typed Properties Crash). (Nikita) diff --git a/ext/curl/tests/bug78775.phpt b/ext/curl/tests/bug78775.phpt new file mode 100644 index 0000000000..490c168166 --- /dev/null +++ b/ext/curl/tests/bug78775.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #78775: TLS issues from HTTP request affecting other encrypted connections +--SKIPIF-- +<?php +if (!extension_loaded('curl')) die('skip Requires curl'); +if (getenv('SKIP_ONLINE_TESTS')) die('skip Online test'); +?> +--FILE-- +<?php + +$sock = fsockopen("tls://google.com", 443); + +var_dump($sock); + +$handle = curl_init('https://self-signed.badssl.com/'); +curl_setopt_array( + $handle, + [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_SSL_VERIFYPEER => true, + ] +); + +var_dump(curl_exec($handle)); +curl_close($handle); + +fwrite($sock, "GET / HTTP/1.0\n\n"); +var_dump(fread($sock, 8)); + +?> +--EXPECTF-- +resource(%d) of type (stream) +bool(false) +string(8) "HTTP/1.0" diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 25472959d7..635bcbf330 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -1965,6 +1965,7 @@ static int php_openssl_enable_crypto(php_stream *stream, do { struct timeval cur_time, elapsed_time; + ERR_clear_error(); if (sslsock->is_client) { n = SSL_connect(sslsock->ssl_handle); } else { @@ -2137,6 +2138,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si } /* Now, do the IO operation. Don't block if we can't complete... */ + ERR_clear_error(); if (read) { nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count); |