From: php_dot_net at edelhost dot de
Operating system: Linux 2.6.18.k7
PHP version: 5.2.0
PHP Bug Type: cURL related
Bug description: curl_setopt/curl_setopt_array returns true for
CURLOPT_FOLLOWLOCATION => true i
Description:
------------
Summary:
curl_setopt/curl_setopt_array returns true for CURLOPT_FOLLOWLOCATION =>
true in safe_mode and/or with open_basedir
Description:
If safe_mode was activated and/or an open_basedir restriction was set, the
cURL option CURLOPT_FOLLOWLOCATION can't be switched to true. You will be
informed about this with a warning from PHP. So far so well.
But docu says, if an option can not be set by curl_setopt() it will return
false, alternatively curl_setopt_array() will immediately return false, if
one of the options can not be set.
Reproduce code:
---------------
<?php
$ch_opts = array(CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 5,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL=>'http://tinyurl.com/yhor2h'#redir 2
http://de.php.net/news.rss
);
$ch = curl_init();
var_dump(curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true));
var_dump($opts_set = curl_setopt_array($ch, $ch_opts));
if (!$opts_set) {
curl_close($ch);
die('failed to set options');
}
if (!($response = curl_exec($ch))) {
$errmsg = sprintf("curl_exec error: code: %d; message: %s",
curl_errno($ch), curl_error($ch));
curl_close($ch);
die($errmsg);
}
curl_close($ch);
echo $response;
?>
Expected result:
----------------
bool(false)
bool(false)
failed to set options
Actual result:
--------------
bool(true)
bool(true)
curl_exec error: code: 0; message:
--
Edit bug report at http://bugs.php.net/?id=39817&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=39817&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=39817&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=39817&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=39817&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=39817&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=39817&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=39817&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=39817&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=39817&r=support
Expected behavior: http://bugs.php.net/fix.php?id=39817&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=39817&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=39817&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=39817&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39817&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=39817&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=39817&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=39817&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=39817&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=39817&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=39817&r=mysqlcfg