Edit report at https://bugs.php.net/bug.php?id=61886&edit=1
ID: 61886
User updated by: develop1983 at gmail dot com
Reported by: develop1983 at gmail dot com
Summary: cURL returns error 209
Status: Open
Type: Bug
Package: cURL related
Operating System: win7 x86
PHP Version: 5.3.11
Block user comment: N
Private report: N
New Comment:
PHP 5.3.9 cURL version - 7.21.7
PHP 5.3.11 cURL version - 7.24.0
Previous Comments:
------------------------------------------------------------------------
[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