summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_url.class17
1 files changed, 12 insertions, 5 deletions
diff --git a/it_url.class b/it_url.class
index c3786f1..94ac466 100644
--- a/it_url.class
+++ b/it_url.class
@@ -350,11 +350,16 @@ static function get_multi($p=null)
if (!$p['noresults'])
$keyorder = array_keys($p['urls']);
- reset($p['urls']);
+ if (is_array($p['urls']))
+ $iterator = (new ArrayObject($p['urls']))->getIterator();
+ else
+ $iterator = $p['urls'];
$parallel = $p['parallel'] ?: PHP_INT_MAX;
- while (count($handles) < $parallel && ($next = each($p['urls'])))
- $addhandle($next['key'], $next['value']);
+ while (count($handles) < $parallel && $iterator->valid()) {
+ $addhandle($iterator->key(), $iterator->current());
+ $iterator->next();
+ }
$start = gettimeofday(true);
@@ -398,8 +403,10 @@ static function get_multi($p=null)
$closehandle($key);
}
- if (!$abort && count($handles) < $parallel && ($next = each($p['urls'])))
- $addhandle($next['key'], $next['value']);
+ if (!$abort && count($handles) < $parallel && $iterator->valid()) {
+ $addhandle($iterator->key(), $iterator->current());
+ $iterator->next();
+ }
}
}
} while ($mrc == CURLM_CALL_MULTI_PERFORM);