Skip to content

Commit 747cb46

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2: Fixed bug #78775
2 parents 85874af + 4f984a2 commit 747cb46

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
@@ -27,6 +27,10 @@ PHP NEWS
2727
non-ascii characters). (mhagstrand)
2828
. Fixed bug #78747 (OpCache corrupts custom extension result). (Nikita)
2929

30+
- OpenSSL:
31+
. Fixed bug #78775 (TLS issues from HTTP request affecting other encrypted
32+
connections). (Nikita)
33+
3034
- Reflection:
3135
. Fixed bug #78697 (ReflectionClass::ImplementsInterface - inaccurate error
3236
message with traits). (villfa)

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
@@ -1921,6 +1921,7 @@ static int php_openssl_enable_crypto(php_stream *stream,
19211921
do {
19221922
struct timeval cur_time, elapsed_time;
19231923

1924+
ERR_clear_error();
19241925
if (sslsock->is_client) {
19251926
n = SSL_connect(sslsock->ssl_handle);
19261927
} else {
@@ -2093,6 +2094,7 @@ static size_t php_openssl_sockop_io(int read, php_stream *stream, char *buf, siz
20932094
}
20942095

20952096
/* Now, do the IO operation. Don't block if we can't complete... */
2097+
ERR_clear_error();
20962098
if (read) {
20972099
nr_bytes = SSL_read(sslsock->ssl_handle, buf, (int)count);
20982100

0 commit comments

Comments
 (0)