Skip to content

Commit 079905a

Browse files
committed
Fix #78090: bug45161.phpt takes forever to finish
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.
1 parent fe1bfb7 commit 079905a

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ PHP NEWS
4545
- Standard:
4646
. Fixed bug #78902 (Memory leak when using stream_filter_append). (liudaixiao)
4747

48+
- Testing:
49+
. Fixed bug #78090 (bug45161.phpt takes forever to finish). (cmb)
50+
4851
- XSL:
4952
. Fixed bug #70078 (XSL callbacks with nodes as parameter leak memory). (cmb)
5053

ext/curl/tests/bug45161.phpt

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22
Bug #45161 (Reusing a curl handle leaks memory)
33
--SKIPIF--
44
<?php
5-
if (substr(PHP_OS, 0, 3) == 'WIN') {
6-
exit("skip not for Windows");
7-
}
8-
if (!extension_loaded("curl")) {
9-
exit("skip curl extension not loaded");
10-
}
5+
include 'skipif.inc';
116
$curl_version = curl_version();
127
if ($curl_version['version_number'] < 0x071100) {
138
exit("skip: test works only with curl >= 7.17.0");
149
}
1510
?>
1611
--FILE--
1712
<?php
13+
include 'server.inc';
14+
$host = curl_cli_server_start();
1815

1916
// Fill memory for test
2017
$ch = curl_init();
21-
$fp = fopen('/dev/null', 'w');
18+
$fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w');
2219

2320
/*
2421
$i = $start = $end = 100000.00;
@@ -32,7 +29,7 @@ for ($i = 0; $i < 100; $i++) {
3229
// Start actual test
3330
$start = memory_get_usage() + 1024;
3431
for($i = 0; $i < 1024; $i++) {
35-
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
32+
curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
3633
curl_setopt($ch, CURLOPT_FILE, $fp);
3734
curl_exec($ch);
3835
}

ext/curl/tests/bug46739.phpt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
Bug #46739 (array returned by curl_getinfo should contain content_type key)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("curl")) {
6-
exit("skip curl extension not loaded");
7-
}
5+
include 'skipif.inc';
86
?>
97
--FILE--
108
<?php
11-
$ch = curl_init('http://127.0.0.1:9/');
9+
include 'server.inc';
10+
$host = curl_cli_server_start();
11+
$ch = curl_init("{$host}/get.inc");
12+
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
1213

1314
curl_exec($ch);
1415
$info = curl_getinfo($ch);

0 commit comments

Comments
 (0)