fix ::toStream() in ZTS
[m6w6/ext-http] / tests / helper / server.inc
index 26f0c5041c0faff35b2aa512f360f97b673ba902..ed8516b3a6a6b07d0809a6328d30a504b0dda63e 100644 (file)
@@ -11,8 +11,13 @@ function serve(callable $cb) {
                                        if (getenv("PHP_HTTP_TEST_SSL")) {
                                                stream_socket_enable_crypto($client, true, STREAM_CRYPTO_METHOD_SSLv23_SERVER);
                                        }
-                                       while (!feof($client)) {
-                                               $cb($client);
+                                       try {
+                                               while (!feof($client)) {
+                                                       $cb($client);
+                                               }
+                                       } catch (Exception $ex) {
+                                               fprintf(STDERR, "%s\n", $ex);
+                                               break;
                                        }
                                }
                        } while ($select !== false);