From:
Operating system: win7 x86
PHP version: 5.3.11
Package: cURL related
Bug Type: Bug
Bug description:cURL returns error 209
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 bug report at https://bugs.php.net/bug.php?id=61886&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=61886&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=61886&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=61886&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=61886&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=61886&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=61886&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=61886&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=61886&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=61886&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=61886&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=61886&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=61886&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=61886&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=61886&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=61886&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=61886&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=61886&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=61886&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=61886&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=61886&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=61886&r=mysqlcfg