From:             adz999 at yahoo dot co dot uk
Operating system: Free BSD (i386)
PHP version:      5.2.3
PHP Bug Type:     cURL related
Bug description:  curl_multi_select causes php to fail, silently

Description:
------------
I am using (a slight variation of) the user-contributed example on this
page:http://uk2.php.net/manual/en/function.curl-multi-exec.php.

Sometimes it works and sometimes it causes php to fail, without displaying
any error notice (error reporting set to E_WARNING).  I cannot work out
what it is that causes it to fail or not fail, but if I run the same
requests on the script multiple times it behaves the same every time.

By getting php to print a message between each line of code I have
narrowed the problem down to this line:
if (curl_multi_select($mh) != -1)

This is the php info for the server:
http://phpinfo.hostultra.com/

The problem does NOT occur when the script is executed on my local testing
server (Mac OS X 10.4.8, PHP 5.2.1).



Reproduce code:
---------------
<?php
$mh = curl_multi_init();
foreach(array_keys($arr_requests) as $i)
                curl_multi_add_handle ($mh,$arr_requests[$i]); //each element of
$arr_requests is a curl handle

print "got as far as executing the curl stuff<br>"; while
(@ob_end_flush()); while (@flush());

do              {
                $mrc = curl_multi_exec($mh, $active);
                } while ($mrc == CURLM_CALL_MULTI_PERFORM && $active>0 &&
microtime(1)<$time);


print "1<br>"; while (@ob_end_flush()); while (@flush());

while ($active>0 and $mrc == CURLM_OK && microtime(1)<$time){
                print "2<br>"; while (@ob_end_flush()); while (@flush()); 
//this gets
printed out fine
                // wait for network
                if (curl_multi_select($mh) != -1){
                                // pull in any new data, or at least handle 
timeouts
                        do              {
                                                print "3<br>"; while 
(@ob_end_flush()); while (@flush()); //php
never gets this far
                                                $mrc = curl_multi_exec($mh, 
$active);
                                                } while ($mrc == 
CURLM_CALL_MULTI_PERFORM && $active>0 &&
microtime(1)<$time);
                                }
                }//end while

Expected result:
----------------
If curl_multi_select($mh) was equal to -1 then I would expect the while
loop
while ($active>0 and $mrc == CURLM_OK && microtime(1)<$time)

Actual result:
--------------
PHP outputs:
got as far as executing the curl stuff
1
2

...and then it stops.  The connection to the browser is no longer active. 
That's it, it just stops there and does no more.  No error message.


Even if I change the line
if (curl_multi_select($mh) != -1)
to just
if (curl_multi_select($mh))

the result is exactly the same

-- 
Edit bug report at http://bugs.php.net/?id=42020&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=42020&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=42020&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=42020&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=42020&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=42020&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=42020&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=42020&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=42020&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=42020&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=42020&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=42020&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=42020&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=42020&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=42020&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=42020&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=42020&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=42020&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=42020&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=42020&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=42020&r=mysqlcfg

Reply via email to