From:             
Operating system: linux 2.6.32-24 libcurl 7.21.0
PHP version:      5.3.3
Package:          cURL related
Bug Type:         Bug
Bug description:multi curl fails to return response, where curl does.

Description:
------------
When using both curl and multi_curl i get a curl_errno of 0 for each handle
while an curl_error results a string error.



When using multi_curl the error string is:  Failed connect to
ftp.nmh.ac.uk:21; Operation now in progress



When using curl the error string is: couldn't connect to host



Using multi_curl results in a null body returned with
curl_multi_getcontent

Using curl yields the data of the file when using curl_exec

Test script:
---------------
two scripts are below to reproduce.



# multi_curl method

<?php



$curls = array();

$cmh = curl_multi_init();



$dlFiles = array(

  'ftp://ftp.nmh.ac.uk/wdc/obsdata/hourval/single_year/1914/sod1914.wdc',

  'http://spc.igpp.ucla.edu/uclamag/ffi/lal/B99300_LAL.ffd',

  'ftp://ftp.nmh.ac.uk/wdc/obsdata/hourval/single_year/1922/hua1922.wdc',

 
'http://vmo.igpp.ucla.edu/data1/Weygand/ProcessedSolarWindGSE/ACE/mag/2000/acemag200001.dat'

);



foreach ($dlFiles as $x => $file) {

  $curls[$x] = curl_init();

  curl_setopt($curls[$x], CURLOPT_URL, $file);

  curl_setopt($curls[$x], CURLOPT_RETURNTRANSFER, 1);

  curl_setopt($curls[$x], CURLOPT_FOLLOWLOCATION, 1);

  curl_multi_add_handle($cmh, $curls[$x]);

}



$active = null;



do {

  $mrc = curl_multi_exec($cmh, $active);

} while ($mrc == CURLM_CALL_MULTI_PERFORM);



while ($active && $mrc == CURLM_OK) {

  if (curl_multi_select($cmh) != -1) {

    do {

         $mrc = curl_multi_exec($cmh, $active);

    } while ($mrc == CURLM_CALL_MULTI_PERFORM);

  }

}



foreach ($dlFiles as $x => $file) {

  var_dump(substr(curl_multi_getcontent($curls[$x]), 0, 10),
curl_errno($curls[$x]), curl_error($curls[$x]));

  curl_multi_remove_handle($cmh, $curls[$x]);

  curl_close($curls[$x]);

}



curl_multi_close($cmh);





?>



# curl method

<?php



$dlFiles = array(

  'ftp://ftp.nmh.ac.uk/wdc/obsdata/hourval/single_year/1914/sod1914.wdc',

  'http://spc.igpp.ucla.edu/uclamag/ffi/lal/B99300_LAL.ffd',

  'ftp://ftp.nmh.ac.uk/wdc/obsdata/hourval/single_year/1922/hua1922.wdc',

 
'http://vmo.igpp.ucla.edu/data1/Weygand/ProcessedSolarWindGSE/ACE/mag/2000/acemag200001.dat'

);



foreach ($dlFiles as $x => $file) {

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, $file);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);



  var_dump(substr(curl_exec($ch), 0, 10), curl_errno($ch),
curl_error($ch));



  curl_close($ch);

}



?>

Expected result:
----------------
no errors at all and multi_curl letting me get the contents of the curl.

Actual result:
--------------
multi_curl



bool(false)

int(0)

string(61) "Failed connect to ftp.nmh.ac.uk:21; Operation now in progress"

string(10) "����

int(0)

string(0) ""

bool(false)

int(0)

string(61) "Failed connect to ftp.nmh.ac.uk:21; Operation now in progress"

string(10) "01 01 2000"

int(0)

string(0) ""



for curl

string(10) "SOD1401X01"

int(0)

string(24) "couldn't connect to host"

string(10) "����

int(0)

string(0) ""

string(10) "HUA22 1D 1"

int(0)

string(24) "couldn't connect to host"

string(10) "01 01 2000"

int(0)

string(0) ""

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52558&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52558&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52558&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52558&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52558&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52558&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52558&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52558&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52558&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52558&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52558&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52558&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52558&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52558&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52558&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52558&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52558&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52558&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52558&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52558&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52558&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52558&r=mysqlcfg

Reply via email to