title: curl multi stuck in an infinite loop
body: <p>I am trying to do <code>curl_muliti_*</code>, but I am having issues, and I don't know what is causing the problem. When I run the following code, I get stuck in an infinite loop here <code>while($active &amp;&amp; $mrc === CURLM_OK){</code></p>
  
  <pre><code>$active = null;
  do{
      $mrc = curl_multi_exec($mh, $active);
  }while($mrc === CURLM_CALL_MULTI_PERFORM);
  
  while($active &amp;&amp; $mrc === CURLM_OK){
      if(curl_multi_select($mh) !== -1){
          do{
              $mrc = curl_multi_exec($mh, $active);
          }while($mrc === CURLM_CALL_MULTI_PERFORM);
      }
  }
  </code></pre>
  
  <p>in the loop (above the if) I add <code>var_dump(curl_multi_select($mh))</code> and it outputs <code>int(-1)</code> Why is it doing that? </p>
  
  <p>Here is the full method:</p>
  
  <pre><code>protected function getURLs($other_params = array()){
      $url      = $this-&gt;url;
      $url_list = array();
      if(!is_array($url)){
          return false;
      }
      $mh = curl_multi_init();
      foreach($url as $u){
          $url_list[] = $handle = $this-&gt;curlInit($u, $other_params);
          curl_multi_add_handle($mh, $handle);
      }
      $active = null;
      do{
          $mrc = curl_multi_exec($mh, $active);
      }while($mrc === CURLM_CALL_MULTI_PERFORM);
  
      while($active &amp;&amp; $mrc === CURLM_OK){
          if(curl_multi_select($mh) !== -1){
              do{
                  $mrc = curl_multi_exec($mh, $active);
              }while($mrc === CURLM_CALL_MULTI_PERFORM);
          }
      }
      $data = array();
      foreach($url_list as $handle){
          $data[] = curl_multi_getcontent($handle);
          curl_multi_remove_handle($mh, $handle);
      }
      curl_multi_close($mh);
  
      return $data;
  }
  </code></pre>
  
  <p><strong>Note: Let me know what other code you may need.</strong></p>