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

 ID:                 60790
 Comment by:         bompus at gmail dot com
 Reported by:        leonchuk at gmail dot com
 Summary:            "curl_multi_select" executed first time always one
                     second
 Status:             Open
 Type:               Bug
 Package:            cURL related
 Operating System:   windows (XP,7)
 PHP Version:        5.3.9
 Block user comment: N
 Private report:     N

 New Comment:

Possibly related to 61141 and 61240


Previous Comments:
------------------------------------------------------------------------
[2012-03-24 07:28:59] qiwei dot mo at gmail dot com

I have the same problem white them.
Env: win7 + php5.4.0

Use the code as curl_multi-exec
http://cn2.php.net/manual/zh/function.curl-multi-exec.php
cause the final error: Fatal error: Maximum execution time of 30 seconds 
exceeded. But it be runing well in php5.3.6

In PHP5.4 , when i replace the under code
-----------------------------------
$active = null;
// 执行批处理句柄
do {
    $mrc = curl_multi_exec($mh, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);

while ($active && $mrc == CURLM_OK) {
    if (curl_multi_select($mh) != -1) {
        do {
            $mrc = curl_multi_exec($mh, $active);
        } while ($mrc == CURLM_CALL_MULTI_PERFORM);
    }
}
--------------------------------------
With

do {
        curl_multi_exec($hMultiCurl, $iRunning);
} while ($iRunning > 0);
-------------------------------------

the programe run ok

So the question is the curl_multi_select bug , cause the while infinite loop.

------------------------------------------------------------------------
[2012-02-28 17:04:37] bompus at gmail dot com

I've noticed this as well. The function should return as soon as it is finished 
I 
believe. This could be a CURL issue or a PHP issue. I'm interested to hear what 
the dev's say since I've had all kinds of issues with curl_multi_select in 
newer 
PHP versions. I keep having to revert to 5.3.6.. I've tried 5.3.10 and using 
curl_multi_select within a loop checking for != -1 and it causes an infinite 
loop 
since it always returns -1 on Windows 7 x64/x86, PHP 5.3.10

------------------------------------------------------------------------
[2012-01-18 13:18:08] leonchuk at gmail dot com

Description:
------------
In Windows (tested XP and w7) function "curl_multi_select" executed first time 
always one second (equal to default parameter - $timeout)

---
>From manual page: 
>http://www.php.net/function.curl-multi-init#refsect1-function.curl-multi-init-examples
---


Test script:
---------------
$ch1 = curl_init();
curl_setopt_array($ch1, array(CURLOPT_URL=>"http://lxr.php.net/";, 
CURLOPT_HEADER=>0, CURLOPT_RETURNTRANSFER=>1));
$mh = curl_multi_init();
curl_multi_add_handle($mh,$ch1);

$active = null;
do $mrc = curl_multi_exec($mh, $active);
while ($mrc == CURLM_CALL_MULTI_PERFORM);

$start_time = microtime(true);

while ($active && $mrc == CURLM_OK) {
    if (curl_multi_select($mh) != -1) { #after first run = 1 sec
        echo (microtime(true)-$start_time)."<br>".PHP_EOL; 
        do $mrc = curl_multi_exec($mh, $active);
        while ($mrc == CURLM_CALL_MULTI_PERFORM);
    }
}

curl_multi_remove_handle($mh, $ch1); curl_multi_close($mh);



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60790&edit=1

Reply via email to