ID: 42020 User updated by: adz999 at yahoo dot co dot uk Reported By: adz999 at yahoo dot co dot uk Status: Open Bug Type: cURL related Operating System: Free BSD (i386) PHP Version: 5.2.3 New Comment:
Some of my submission did not post properly: The "Reproduce code" section should have this at the end: print "4<br>"; The "Expected result" section should continue: ...to loop around again, and therefore print out "2<br" again. Or if curl_multi_select($mh) was NOT equal to -1 then I would expect php to print out "3<br>" regardless of whether it then went on to execute curl_multi_exec. Previous Comments: ------------------------------------------------------------------------ [2007-07-17 18:47:26] adz999 at yahoo dot co dot uk 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 this bug report at http://bugs.php.net/?id=42020&edit=1
