Annotation of embedaddon/php/ext/curl/tests/bug45161.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #45161 (Reusing a curl handle leaks memory)
! 3: --SKIPIF--
! 4: <?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: }
! 11: if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
! 12: exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
! 13: }
! 14: $curl_version = curl_version();
! 15: if ($curl_version['version_number'] < 0x071100) {
! 16: exit("skip: test works only with curl >= 7.17.0");
! 17: }
! 18: ?>
! 19: --FILE--
! 20: <?php
! 21:
! 22: // Fill memory for test
! 23: $ch = curl_init();
! 24: $fp = fopen('/dev/null', 'w');
! 25:
! 26: /*
! 27: $i = $start = $end = 100000.00;
! 28: for ($i = 0; $i < 100; $i++) {
! 29: curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
! 30: curl_setopt($ch, CURLOPT_FILE, $fp);
! 31: curl_exec($ch);
! 32: }
! 33: */
! 34:
! 35: // Start actual test
! 36: $start = memory_get_usage() + 1024;
! 37: for($i = 0; $i < 1024; $i++) {
! 38: curl_setopt($ch, CURLOPT_URL, 'http://127.0.0.1:9/');
! 39: curl_setopt($ch, CURLOPT_FILE, $fp);
! 40: curl_exec($ch);
! 41: }
! 42: if ($start < memory_get_usage()) {
! 43: echo 'FAIL';
! 44: } else {
! 45: echo 'PASS';
! 46: }
! 47: echo "\n";
! 48: fclose($fp);
! 49: unset($fp);
! 50: ?>
! 51: --EXPECT--
! 52: PASS
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>