Fix test to use PHP_CURL_HTTP_REMOTE_SERVER

This commit is contained in:
Pierrick Charron 2011-11-21 02:10:57 +00:00
parent 0f0ffd38c9
commit e3557389bf

View file

@ -12,7 +12,7 @@ if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER')) {
--FILE-- --FILE--
<?php <?php
function checkForClosedFilePointer($curl_option, $description) { function checkForClosedFilePointer($host, $curl_option, $description) {
$fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+'); $fp = fopen(dirname(__FILE__) . '/bug54798.tmp', 'w+');
$ch = curl_init(); $ch = curl_init();
@ -28,7 +28,7 @@ function checkForClosedFilePointer($curl_option, $description) {
curl_setopt($ch, $curl_option, $fp); curl_setopt($ch, $curl_option, $fp);
curl_setopt($ch, CURLOPT_URL, 'localhost'); curl_setopt($ch, CURLOPT_URL, $host);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
fclose($fp); // <-- premature close of $fp caused a crash! fclose($fp); // <-- premature close of $fp caused a crash!
@ -47,8 +47,9 @@ $options_to_check = array(
"CURLOPT_INFILE" "CURLOPT_INFILE"
); );
$host = getenv('PHP_CURL_HTTP_REMOTE_SERVER');
foreach($options_to_check as $option) { foreach($options_to_check as $option) {
checkForClosedFilePointer(constant($option), $option); checkForClosedFilePointer($host, constant($option), $option);
} }
?> ?>