From:             
Operating system: win xp, ubuntu 9.10, others
PHP version:      5.3.3
Package:          cURL related
Bug Type:         Bug
Bug description:segfault: curl_multi_* + 2 or more FTP urls

Description:
------------
segfault when requesting 2 or more FTP urls with curl_multi_*



Appears both under WIN XP SP3, ubuntu 8.10, 9.10



segfault when calling test script from command line, for example: 

d:/www4/php5/php -q -c d:/www4/php.ini -f curl_ftp_bug_test.php

and also as apache2 module:

http://localhost/curl_ftp_bug_test.php



php.ini used is default from distribution (php.ini-production) wit only
curl extension enabled:

extension=php_curl.dll



Reproduced every time when call test script.



This bug first reported here:

http://bugs.php.net/bug.php?id=52284

But was set to "Bogus" by mistake.

Test script:
---------------
<?php

function multi_request($urls, $url_options = array()) {

        $mh = curl_multi_init();

        foreach ($urls as $id => $url) {

                $curly[$id] = curl_init();

                curl_setopt($curly[$id], CURLOPT_URL, $url);

                curl_setopt($curly[$id], CURLOPT_RETURNTRANSFER, true);

                // I've add this opt to speed up request, bug appearing with or 
without
this line

                curl_setopt($curly[$id], CURLOPT_NOBODY, true);

                curl_multi_add_handle($mh, $curly[$id]);

        }



        $running = null;

        do {

                $status = curl_multi_exec($mh, $running);

                usleep(1000);

        } while($status == CURLM_CALL_MULTI_PERFORM || $running);



        foreach ($curly as $id => $c) {

                $result[$id] = curl_multi_getcontent($c);

                curl_multi_remove_handle($mh, $c);

                curl_close($c);

        }

        curl_multi_close($mh);



        return $result;

}



$urls = array(

        "4358521"       =>
"ftp://ftp.ea.com/pub/ea/patches/nfs-underground/pc/en-uk/NFSU_EUROPE_PATCH_4.exe";,

        "7458288"       => 
"ftp://ftp.nero.com/software/plugins/WMAPlugin20937.exe";,

);



echo "<pre>";

print_R(multi_request($urls));

echo "</pre>";



Expected result:
----------------
No segfault :)

Actual result:
--------------
segmentation fault

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

Reply via email to