Skip to content

Fix bug #79589: ssl3_read_n:unexpected eof while reading #8558

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ext/openssl/tests/bug79589.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Bug #65538: TLS unexpected EOF failure
--EXTENSIONS--
openssl
--SKIPIF--
<?php
if (getenv("SKIP_ONLINE_TESTS")) die("skip online test");
?>
--FILE--
<?php

$release = file_get_contents(
'https://chromedriver.storage.googleapis.com/LATEST_RELEASE',
false,
stream_context_create(['ssl' => ['verify_peer'=> false]])
);
echo gettype($release);

?>
--EXPECT--
string
5 changes: 5 additions & 0 deletions ext/openssl/xp_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1639,6 +1639,11 @@ int php_openssl_setup_crypto(php_stream *stream,

ssl_ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS;

#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF
/* Only for OpenSSL 3+ to keep OpenSSL 1.1.1 behavior */
ssl_ctx_options |= SSL_OP_IGNORE_UNEXPECTED_EOF;
#endif

if (!GET_VER_OPT("disable_compression") || zend_is_true(val)) {
ssl_ctx_options |= SSL_OP_NO_COMPRESSION;
}
Expand Down