Skip to content

Commit 3e41ade

Browse files
committed
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fixed bug #78775
2 parents 214f4cf + 747cb46 commit 3e41ade

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ PHP NEWS
99
. Fixed bug #77930 (stream_copy_to_stream should use mmap more often).
1010
(Nikita)
1111

12+
- OpenSSL:
13+
. Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted
14+
connections). (Nikita)
15+
1216
- Reflection:
1317
. Fixed bug #78774 (ReflectionNamedType on Typed Properties Crash). (Nikita)
1418

ext/curl/tests/bug78775.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Bug #78775: TLS issues from HTTP request affecting other encrypted connections
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('curl')) die('skip Requires curl');
6+
if (getenv('SKIP_ONLINE_TESTS')) die('skip Online test');
7+
?>
8+
--FILE--
9+
<?php
10+
11+
$sock = fsockopen("tls://google.com", 443);
12+
13+
var_dump($sock);
14+
15+
$handle = curl_init('https://self-signed.badssl.com/');
16+
curl_setopt_array(
17+
$handle,
18+
[
19+
CURLOPT_RETURNTRANSFER => true,
20+
CURLOPT_SSL_VERIFYPEER => true,
21+
]
22+
);
23+
24+
var_dump(curl_exec($handle));
25+
curl_close($handle);
26+
27+
fwrite($sock, "GET / HTTP/1.0\n\n");
28+
var_dump(fread($sock, 8));
29+
30+
?>
31+
--EXPECTF--
32+
resource(%d) of type (stream)
33+
bool(false)
34+
string(8) "HTTP/1.0"

ext/openssl/xp_ssl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,6 +1965,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
19651965
do {
19661966
struct timeval cur_time, elapsed_time;
19671967

1968+
ERR_clear_error();
19681969
if (sslsock->is_client) {
19691970
n = SSL_connect(sslsock->ssl_handle);
19701971
} else {
@@ -2137,6 +2138,7 @@ static ssize_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, si
21372138
}
21382139

21392140
/* Now, do the IO operation. Don't block if we can't complete... */
2141+
ERR_clear_error();
21402142
if (read) {
21412143
nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count);
21422144

0 commit comments

Comments
 (0)