|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-12-13 15:50 UTC] iliaa@php.net
[2006-12-13 16:23 UTC] php_dot_net at edelhost dot de
[2006-12-13 16:31 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 04:00:01 2025 UTC |
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: