svn: /phpdoc/ja/trunk/reference/curl/functions/ curl-multi-info-read.xml
| From: | Yoshinari Takaoka | Date: | Fri, 22 May 2020 22:19:54 +0000 |
| Subject: | svn: /phpdoc/ja/trunk/reference/curl/functions/ curl-multi-info-read.xml | ||
| Groups: | php.doc.ja | ||
| Request: | Send a blank email to doc-ja+get-5653@lists.php.net to get a copy of this message | ||
mumumu Fri, 22 May 2020 22:19:54 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=349955
Log:
fix ugly bug in sample code
imagine if 2 handles finish in the same multi_exec(), before exec() $active is 2 and after the call
$active is 0, then we read the first message, and the the message from the 2nd handle will be
lost/ignored!
this has caused real bugs in the wild, see https://stackoverflow.com/questions/61920359/count-how-many-curl-multi-requests-have-been-made/61923372
Patch provided by divinity76.
Changed paths:
U phpdoc/ja/trunk/reference/curl/functions/curl-multi-info-read.xml
Modified: phpdoc/ja/trunk/reference/curl/functions/curl-multi-info-read.xml
===================================================================
--- phpdoc/ja/trunk/reference/curl/functions/curl-multi-info-read.xml 2020-05-22 06:31:42 UTC (rev
349954)
+++ phpdoc/ja/trunk/reference/curl/functions/curl-multi-info-read.xml 2020-05-22 22:19:54 UTC (rev
349955)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
-<!-- EN-Revision: 346933 Maintainer: takagi Status: ready -->
+<!-- EN-Revision: 349952 Maintainer: takagi Status: ready -->
<!-- Credits: mumumu -->
<refentry xml:id="function.curl-multi-info-read" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
@@ -114,8 +114,7 @@
if ($active) {
curl_multi_select($mh);
}
- $info = curl_multi_info_read($mh);
- if (false !== $info) {
+ while (false !== ($info = curl_multi_info_read($mh))) {
var_dump($info);
}
} while ($active && $status == CURLM_OK);