Test Failure Report for ext/standard/tests/http/bug60570.phpt ('Bug #60570 (Stream context leaks when http request fails)')
Script
1:
<?php 2: require 'server.inc'; 3: 4: function do_test() { 5: 6: $responses = array( 7: "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", 8: "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n", 9: "data://text/plain,HTTP/1.0 404 Not Found\r\n\r\n" 10: ); 11: 12: $pid = http_server("tcp://127.0.0.1:12342", $responses, $output); 13: 14: $a = $b = null; 15: 16: $i = 3; 17: while ($i--) { 18: $context = stream_context_create(array('http'=>array('timeout'=>1))); 19: file_get_contents('http://127.0.0.1:12342/', 0, $context); 20: unset($context); 21: 22: $b = $a; 23: $a = memory_get_usage(); 24: } 25: 26: http_server_kill($pid); 27: 28: echo "leak? penultimate iteration: $b, last one: $a\n"; 29: var_dump($a == $b); 30: } 31: 32: do_test(); 33: 34:
Expected
Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
in %s on line %d
leak? penultimate iteration: %d, last one: %d
bool(true)
Output
leak? penultimate iteration: 8208, last one: 8208
bool(true)
Diff
001+ leak? penultimate iteration: 8208, last one: 8208
002+ bool(true)
001- Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
002- in %s on line %d
003-
004- Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
005- in %s on line %d
006-
007- Warning: file_get_contents(http://127.0.0.1:12342/): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
008- in %s on line %d
009- leak? penultimate iteration: %d, last one: %d
010- bool(true)
Generated at Sun, 19 May 2013 20:27:25 +0000 (46 hours ago)
|