diff --git a/ext/openssl/tests/bug79589.phpt b/ext/openssl/tests/bug79589.phpt new file mode 100644 index 0000000000000..5d277e8c63ce6 --- /dev/null +++ b/ext/openssl/tests/bug79589.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #65538: TLS unexpected EOF failure +--EXTENSIONS-- +openssl +--SKIPIF-- + +--FILE-- + ['verify_peer'=> false]]) +); +echo gettype($release); + +?> +--EXPECT-- +string diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 918b3ca5b21df..ce23fb29f4296 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -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; }