Edit report at http://bugs.php.net/bug.php?id=52411&edit=1

 ID:                 52411
 Updated by:         ka...@php.net
 Reported by:        profy dot net at gmail dot com
 Summary:            segfault: curl_multi_* + 2 or more FTP urls
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            cURL related
 Operating System:   win xp, ubuntu 9.10, others
 PHP Version:        5.3.3
 Block user comment: N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-07-23 08:16:59] profy dot net at gmail dot com

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 this bug report at http://bugs.php.net/bug.php?id=52411&edit=1

Reply via email to