Skip to content

Commit 1cd04d8

Browse files
author
Jani Taskinen
committed
MFH: bug tests
1 parent 3fff948 commit 1cd04d8

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

ext/curl/tests/bug45161.phpt

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--TEST--
2+
Bug #45161 (Reusing a curl handle leaks memory)
3+
--FILE--
4+
<?php
5+
6+
// Fill memory for test
7+
$ch = curl_init();
8+
$fp = fopen('/dev/null', 'w');
9+
10+
/*
11+
$i = $start = $end = 100000.00;
12+
for ($i = 0; $i < 100; $i++) {
13+
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
14+
curl_setopt($ch, CURLOPT_FILE, $fp);
15+
curl_exec($ch);
16+
}
17+
*/
18+
19+
// Start actual test
20+
$start = memory_get_usage() + 1024;
21+
for($i = 0; $i < 1024; $i++) {
22+
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
23+
curl_setopt($ch, CURLOPT_FILE, $fp);
24+
curl_exec($ch);
25+
}
26+
if ($start < memory_get_usage()) {
27+
echo 'FAIL';
28+
} else {
29+
echo 'PASS';
30+
}
31+
echo "\n";
32+
fclose($fp);
33+
unset($fp);
34+
?>
35+
--EXPECT--
36+
PASS

ext/curl/tests/bug46739.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #46739 (array returned by curl_getinfo should contain content_type key)
3+
--FILE--
4+
<?php
5+
$ch = curl_init('http://127.0.0.1:9/');
6+
7+
curl_exec($ch);
8+
$info = curl_getinfo($ch);
9+
10+
echo (array_key_exists('content_type', $info)) ? "set" : "not set";
11+
?>
12+
--EXPECT--
13+
set

0 commit comments

Comments
 (0)