Files
php-src/ext/curl/tests/bug45161.phpt
Christoph M. Becker 355baf982e Revert "Skip bug45161.phpt on Windows"
This reverts commit 4b22c3e3ad.

As quick measure for GH-10753, that test was skipped on Windows.
However, it seems that there are no longer performance issues with
newer cURL versions, so we run that test again on Windows.

Fixes GH-10753.
Closes GH-14998.
2024-07-18 12:42:01 +02:00

41 lines
792 B
PHP

--TEST--
Bug #45161 (Reusing a curl handle leaks memory)
--EXTENSIONS--
curl
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
// Fill memory for test
$ch = curl_init();
$fp = fopen(PHP_OS_FAMILY === 'Windows' ? 'nul' : '/dev/null', 'w');
/*
$i = $start = $end = 100000.00;
for ($i = 0; $i < 100; $i++) {
curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
}
*/
// Start actual test
$start = memory_get_usage() + 1024;
for($i = 0; $i < 1024; $i++) {
curl_setopt($ch, CURLOPT_URL, "{$host}/get.inc");
curl_setopt($ch, CURLOPT_FILE, $fp);
curl_exec($ch);
}
if ($start < memory_get_usage()) {
echo 'FAIL';
} else {
echo 'PASS';
}
echo "\n";
fclose($fp);
unset($fp);
?>
--EXPECT--
PASS