Bug #16600
closed
CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set
Added by Schmid Valentin almost 18 years ago.
Updated about 16 years ago.
Description
Since uprgrading from 4.0.0 to 4.0.2 I noticed a lot of warnings in my php-error-log.
The warning looks like this:
PHP Warning: curl_setopt() [<a href='function.curl-setopt'>function.curl-setopt</a>]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /..../typo3_src-4.0.2/t3lib/class.t3lib_div.php on line 2322
I think the option CURLOPT_FOLLOWLOCATION should be set optional by a configuration parameter.
My php version is 5.1.6 and open_basedir is set
Workaround: uncomment the line 2322 in class.t3lib_div.php
or set it like the following
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
(issue imported from #M4292)
I've the some problem with PHP 5.2.1. It seems that this relies on a security change made in PHP 4.4.4 and PHP 5.1.5 (see changelog). There are some solutions posted in the PHP function comments (see http://de.php.net/curl_setopt).
Since this part of TYPO3 is called quite often it would be good to have it fixed quickly.
"There are some solutions posted in the PHP function comments (see http://de.php.net/curl_setopt). [^]
Since this part of TYPO3 is called quite often it would be good to have it fixed quickly."
Any advice on where do exactly we apply the fix recommended in the PHP function comments above?
The file and line where the error occurs is posted in the bug description.
How to implement a solution depends on what functionality is implied by setting the CURL option.
I took a further look at the problem and IMHO the solution suggested on php.net is too oversized to fit the needs. So I suggest simply to mute the waring by prefixing the curl_setopt call with an '@' or adding an if statement to check whether a base_dir is set or the safe_mode is enabled:
if (ini_get('open_basedir') '' && ini_get('safe_mode' 'Off'))
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
Perhaps the second solution is better to recognize why this change was made.
If $TYPO3_CONF_VARS['SYS']['curlUse'] is set and CURLOPT_FOLLOWLOCATION can't be activated t3lib::getURL() won't follow redirects. Perhaps this should be added somewhere as "know issue".
This is similar or the same with #17479.
Also available in: Atom
PDF