Browse Source
Makes the sapi web server and curl tests more reliable
Makes the sapi web server and curl tests more reliable
1. Increased the time for the sapi/cli/tests/php_cli_server.inc to accept connections. 2. sapi/cli/tests/php_cli_server.inc has errors messages and a `stop` function. 3. bug67429.phpt uses the `stop` function to shutdown the webserver before starting a new one. 4. Removed ext/curl/tests/bug48203_multi-win32.phpt test now that ext/curl/tests/bug48203_multi.phpt runs on Windows also.pull/2242/head
committed by
Nikita Popov
5 changed files with 74 additions and 123 deletions
-
89ext/curl/tests/bug48203_multi-win32.phpt
-
30ext/curl/tests/bug48203_multi.phpt
-
4ext/curl/tests/server.inc
-
7sapi/cli/tests/bug67429.phpt
-
67sapi/cli/tests/php_cli_server.inc
@ -1,89 +0,0 @@ |
|||
--TEST-- |
|||
Variation of bug #48203 with curl_multi_exec (Crash when file pointers passed to curl are closed before calling curl_multi_exec) |
|||
--SKIPIF-- |
|||
<?php |
|||
include 'skipif.inc'; |
|||
if(substr(PHP_OS, 0, 3) != 'WIN' ) { |
|||
die('skip Windows only test'); |
|||
} |
|||
?> |
|||
--FILE-- |
|||
<?php |
|||
include 'server.inc'; |
|||
function checkForClosedFilePointer($curl_option, $description) { |
|||
$fp = fopen(dirname(__FILE__) . '/bug48203.tmp', 'w'); |
|||
|
|||
$ch1 = curl_init(); |
|||
$ch2 = curl_init(); |
|||
|
|||
$options = array( |
|||
CURLOPT_RETURNTRANSFER => 1, |
|||
$curl_option => $fp, |
|||
CURLOPT_URL => curl_cli_server_start() |
|||
); |
|||
|
|||
// we also need to set CURLOPT_VERBOSE to test CURLOPT_STDERR properly |
|||
if (CURLOPT_STDERR == $curl_option) { |
|||
$options[CURLOPT_VERBOSE] = 1; |
|||
} |
|||
|
|||
if (CURLOPT_INFILE == $curl_option) { |
|||
$options[CURLOPT_UPLOAD] = 1; |
|||
} |
|||
|
|||
curl_setopt_array($ch1, $options); |
|||
curl_setopt_array($ch2, $options); |
|||
|
|||
fclose($fp); // <-- premature close of $fp caused a crash! |
|||
|
|||
$mh = curl_multi_init(); |
|||
|
|||
curl_multi_add_handle($mh, $ch1); |
|||
curl_multi_add_handle($mh, $ch2); |
|||
|
|||
$active = 0; |
|||
do { |
|||
curl_multi_exec($mh, $active); |
|||
} while ($active > 0); |
|||
|
|||
curl_multi_remove_handle($mh, $ch1); |
|||
curl_multi_remove_handle($mh, $ch2); |
|||
curl_multi_close($mh); |
|||
|
|||
echo "Ok for $description\n"; |
|||
} |
|||
|
|||
$options_to_check = array( |
|||
"CURLOPT_STDERR", "CURLOPT_WRITEHEADER", "CURLOPT_FILE", "CURLOPT_INFILE" |
|||
); |
|||
|
|||
foreach($options_to_check as $option) { |
|||
checkForClosedFilePointer(constant($option), $option); |
|||
} |
|||
|
|||
?> |
|||
--CLEAN-- |
|||
<?php @unlink(dirname(__FILE__) . '/bug48203.tmp'); ?> |
|||
--EXPECTF-- |
|||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_STDERR resource has gone away, resetting to stderr in %s on line %d |
|||
Ok for CURLOPT_STDERR |
|||
%A |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_WRITEHEADER resource has gone away, resetting to default in %s on line %d |
|||
Ok for CURLOPT_WRITEHEADER |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_FILE resource has gone away, resetting to default in %s on line %d |
|||
Hello World! |
|||
Hello World!Hello World! |
|||
Hello World!Ok for CURLOPT_FILE |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d |
|||
|
|||
Warning: curl_multi_exec(): CURLOPT_INFILE resource has gone away, resetting to default in %s on line %d |
|||
Ok for CURLOPT_INFILE |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue