From: peaceable_whale at hotmail dot com
Operating system: All
PHP version: 5.3.0
PHP Bug Type: cURL related
Bug description: CURLOPT_FAILONERROR does not work when CURLOPT_URL is reset
Description:
------------
CURLOPT_FAILONERROR does not work when CURLOPT_URL is reset. Not false is
returned even when the response code is >=400.
Reproduce code:
---------------
<?php
header("Content-Type: text/plain; charset=UTF-8");
header("X-Content-Type-Options: nosniff");
$request=curl_init();
curl_setopt_array($request,array(CURL_HTTP_VERSION_1_1=>true,CURLOPT_USERAGENT=>"PHP/".phpversion(),CURLOPT_FAILONERROR=>false,CURLOPT_RETURNTRANSFER=>true));
for($i=0;$i<5;$i++) {
curl_setopt($request,CURLOPT_URL,"http://example.com/".$i);
echo "Trial ".$i.":
".(curl_exec($request)===false?"false":"true")."\r\n";
}
curl_close($request);
?>
Expected result:
----------------
Trial 0: false
Trial 1: false
Trial 2: false
Trial 3: false
Trial 4: false
Actual result:
--------------
Trial 0: true
Trial 1: true
Trial 2: true
Trial 3: true
Trial 4: true
--
Edit bug report at http://bugs.php.net/?id=49066&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49066&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49066&r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49066&r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49066&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=49066&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49066&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=49066&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=49066&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=49066&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=49066&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=49066&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=49066&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=49066&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49066&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49066&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=49066&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=49066&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=49066&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=49066&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=49066&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=49066&r=mysqlcfg