Doc #63842 [Com]: Infinite loop in example code
| From: | mail+php at requinix dot net | Date: | Mon, 31 Dec 2012 23:04:18 +0000 |
| Subject: | Doc #63842 [Com]: Infinite loop in example code | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9336@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63842&edit=1
ID: 63842
Comment by: mail+php at requinix dot net
Reported by: dean at ovts dot com dot au
Summary: Infinite loop in example code
Status: Open
Type: Documentation Problem
Package: Documentation problem
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
curl_multi_init()'s example has the same problem. Given the history of the
underlying bug (see bug #63411, bug #61141) I'm hesitant to just go in and
submit a change.
In the comments for 61141 are two code bits that should work, the preferred one
(from pierrick) being
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($mh) == -1) usleep(100);
do { $mrc = curl_multi_exec($mh, $active); }
while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
Previous Comments:
------------------------------------------------------------------------
[2012-12-24 06:48:36] dean at ovts dot com dot au
Description:
------------
---
From manual page: http://www.php.net/function.curl-multi-exec
---
I think there's a bug in the sample code.
If curl_multi_select() returns -1, then the while{} loop just keeps calling it until it returns
something else.
So if repeated calles to curl_multi_select() can return -1 indefinitely (and the comments on the
manual page for that function suggest it can), then the example code will just go into an infinite
loop.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63842&edit=1