ID:               39817
 Updated by:       [EMAIL PROTECTED]
 Reported By:      php_dot_net at edelhost dot de
-Status:           Assigned
+Status:           Feedback
 Bug Type:         cURL related
 Operating System: Linux 2.6.18.k7
 PHP Version:      5.2.0
 Assigned To:      iliaa
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

I've just tried in latest CVS and as long either safe_mode or 
open_basedir is set the options are set to FALSE and return 
errors when you try to change and certainly do not follow the 
redirect.


Previous Comments:
------------------------------------------------------------------------

[2006-12-13 14:30:41] php_dot_net at edelhost dot de

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 this bug report at http://bugs.php.net/?id=39817&edit=1

Reply via email to