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

 ID:                 61886
 Updated by:         paj...@php.net
 Reported by:        develop1983 at gmail dot com
 Summary:            cURL returns error 209
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            cURL related
 Operating System:   win7 x86
 PHP Version:        5.3.11
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.




Previous Comments:
------------------------------------------------------------------------
[2012-05-01 09:23:06] develop1983 at gmail dot com

PHP 5.3.9 cURL version - 7.21.7
PHP 5.3.11 cURL version - 7.24.0

------------------------------------------------------------------------
[2012-05-01 07:36:52] develop1983 at gmail dot com

Description:
------------
I get these warnings:

Warning: (null)(): 209 is not a valid cURL handle resource in Unknown on line 0
Warning: (null)(): 211 is not a valid cURL handle resource in Unknown on line 0

After it the script stoped by "max_execution_time" (=300).

Test script:
---------------
// Simple script to do multiple queries
// It works in PHP 5.3.9
// It doesn't work in PHP 5.3.11, 5.4.0
// I didn't tested in 5.4.1, but I think it still exists there (because it 
exists in PHP 5.3.11)
// Requested URL is valid and I can get the content using the browser and with 
PHP 5.3.9 (i mean the cURL in PHP 5.3.9 package)

$mh = curl_multi_init();
$ch_array = array ();
// $links - Zend_Db_Table_Rowset
// $link - Zend_Db_Table_Row
foreach ($links as $key => $link) {
  $url = $link->getUrl();
  $cookies = $link->getCookies();
  $cookiejar = $this->_config->search->cookie->path . DS . $key;
  $headers = $link->getHeaders();
  $ch = curl_init($url);
  if (substr($url, 0, 8) == 'https://') {
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  }
  curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $link->getTimeout());
  if (!file_exists($cookiejar)) {
    if (!empty($cookies)) {
      curl_setopt($ch, CURLOPT_COOKIE, $cookies);
    }
  } else {
    curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiejar);
  }
  curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiejar);
  if (!empty($headers)) {
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  }
  curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  curl_setopt($ch, CURLOPT_HEADER, false);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_TIMEOUT_MS, $link->getTimeout());
  curl_setopt($ch, CURLOPT_USERAGENT, $user_agent_string);
  curl_multi_add_handle($mh, $ch);
  $ch_array[$key] = $ch;
}

do {
  $execReturnValue = curl_multi_exec($mh, $runningHandles);
} while ($execReturnValue == CURLM_CALL_MULTI_PERFORM);

while ($runningHandles && $execReturnValue == CURLM_OK) {
  if (curl_multi_select($mh) != -1) {
    do {
      $execReturnValue = curl_multi_exec($mh, $runningHandles);
      $info = curl_multi_info_read($mh);
      if ($info['msg'] == CURLMSG_DONE) {
        $ch = $info['handle'];
        if ($info['result'] == CURLM_OK) {
          // process data
        } else {
          // error
        }
        curl_multi_remove_handle($mh, $ch);
        curl_close($ch);
      }
    } while ($execReturnValue == CURLM_CALL_MULTI_PERFORM);
  }
}
curl_multi_close($mh);




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



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

Reply via email to