]> granicus.if.org Git - php/commitdiff
Fix #78090: bug45161.phpt takes forever to finish
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 3 Feb 2020 10:47:01 +0000 (11:47 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 3 Feb 2020 23:44:04 +0000 (00:44 +0100)
Not all systems support the discard protocol (TCP port 9), and since
there is no particular reason to use it, we switch to using actual
server testing.

NEWS
ext/curl/tests/bug45161.phpt
ext/curl/tests/bug46739.phpt

diff --git a/NEWS b/NEWS
index 06c7e567d45da9a91b340f737151ae687aa36e16..c5adbf15264615da7d27038e8283b3c21fee6dea 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -45,6 +45,9 @@ PHP                                                                        NEWS
 - Standard:
   . Fixed bug #78902 (Memory leak when using stream_filter_append). (liudaixiao)
 
+- Testing:
+  . Fixed bug #78090 (bug45161.phpt takes forever to finish). (cmb)
+
 - XSL:
   . Fixed bug #70078 (XSL callbacks with nodes as parameter leak memory). (cmb)
 
index bf6f66977144cd71e69655ce19c9891c61876ba5..d6d722fe281fa2c10b48eac628515f5f5150a274 100644 (file)
@@ -2,12 +2,7 @@
 Bug #45161 (Reusing a curl handle leaks memory)
 --SKIPIF--
 <?php
-if (substr(PHP_OS, 0, 3) == 'WIN') {
-       exit("skip not for Windows");
-}
-if (!extension_loaded("curl")) {
-       exit("skip curl extension not loaded");
-}
+include 'skipif.inc';
 $curl_version = curl_version();
 if ($curl_version['version_number'] < 0x071100) {
        exit("skip: test works only with curl >= 7.17.0");
@@ -15,10 +10,12 @@ if ($curl_version['version_number'] < 0x071100) {
 ?>
 --FILE--
 <?php
+include 'server.inc';
+$host = curl_cli_server_start();
 
 // Fill memory for test
 $ch = curl_init();
-$fp = fopen('/dev/null', 'w');
+$fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w');
 
 /*
 $i = $start = $end = 100000.00;
@@ -32,7 +29,7 @@ for ($i = 0; $i < 100; $i++) {
 // Start actual test
 $start = memory_get_usage() + 1024;
 for($i = 0; $i < 1024; $i++) {
-       curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
+       curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
        curl_setopt($ch, CURLOPT_FILE, $fp);
        curl_exec($ch);
 }
index b7adc5662f973cf3730fae8af95c61cd70f94dc6..bf9a5c20d346d5cbe405e0c60e9e42f7998de26c 100644 (file)
@@ -2,13 +2,14 @@
 Bug #46739 (array returned by curl_getinfo should contain content_type key)
 --SKIPIF--
 <?php
-if (!extension_loaded("curl")) {
-       exit("skip curl extension not loaded");
-}
+include 'skipif.inc';
 ?>
 --FILE--
 <?php
-$ch = curl_init('http://127.0.0.1:9/');
+include 'server.inc';
+$host = curl_cli_server_start();
+$ch = curl_init("{$host}/get.inc");
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
 curl_exec($ch);
 $info = curl_getinfo($ch);