@@ -139,6 +139,16 @@ public function testSecureHttpsOnRandomPort()
139139 )));
140140 $ http ->listen ($ socket );
141141
142+ // clear OpenSSL errors from closing the server side before the client reads,
143+ // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
144+ $ socket ->on ('connection ' , function (ConnectionInterface $ conn ) {
145+ $ conn ->on ('close ' , function () {
146+ Loop ::futureTick (function () {
147+ while (openssl_error_string () !== false );
148+ });
149+ });
150+ });
151+
142152 $ result = $ connector ->connect ($ socket ->getAddress ())->then (function (ConnectionInterface $ conn ) {
143153 $ conn ->write ("GET / HTTP/1.0 \r\nHost: " . noScheme ($ conn ->getRemoteAddress ()) . "\r\n\r\n" );
144154
@@ -172,6 +182,16 @@ public function testSecureHttpsReturnsData()
172182 )));
173183 $ http ->listen ($ socket );
174184
185+ // clear OpenSSL errors from closing the server side before the client reads,
186+ // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
187+ $ socket ->on ('connection ' , function (ConnectionInterface $ conn ) {
188+ $ conn ->on ('close ' , function () {
189+ Loop ::futureTick (function () {
190+ while (openssl_error_string () !== false );
191+ });
192+ });
193+ });
194+
175195 $ connector = new Connector (array (
176196 'tls ' => array ('verify_peer ' => false )
177197 ));
@@ -210,6 +230,16 @@ public function testSecureHttpsOnRandomPortWithoutHostHeaderUsesSocketUri()
210230 )));
211231 $ http ->listen ($ socket );
212232
233+ // clear OpenSSL errors from closing the server side before the client reads,
234+ // as legacy PHP < 7.2 does not (https://bugs.php.net/bug.php?id=78775)
235+ $ socket ->on ('connection ' , function (ConnectionInterface $ conn ) {
236+ $ conn ->on ('close ' , function () {
237+ Loop ::futureTick (function () {
238+ while (openssl_error_string () !== false );
239+ });
240+ });
241+ });
242+
213243 $ result = $ connector ->connect ($ socket ->getAddress ())->then (function (ConnectionInterface $ conn ) {
214244 $ conn ->write ("GET / HTTP/1.0 \r\n\r\n" );
215245
0 commit comments