Skip to content

Commit

Permalink
Fix double redirect bug when running cURL with open_basedir disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
xfra35 committed Dec 17, 2018
1 parent 64aa0e4 commit 021e32e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ function progress($id) {
**/
protected function _curl($url,$options) {
$curl=curl_init($url);
if (!ini_get('open_basedir'))
if (!$open_basedir=ini_get('open_basedir'))
curl_setopt($curl,CURLOPT_FOLLOWLOCATION,
$options['follow_location']);
curl_setopt($curl,CURLOPT_MAXREDIRS,
Expand Down Expand Up @@ -306,7 +306,7 @@ function($curl,$line) use(&$headers) {
curl_close($curl);
$body=ob_get_clean();
if (!$err &&
$options['follow_location'] &&
$options['follow_location'] && $open_basedir &&
preg_grep('/HTTP\/1\.\d 3\d{2}/',$headers) &&
preg_match('/^Location: (.+)$/m',implode(PHP_EOL,$headers),$loc)) {
$options['max_redirects']--;
Expand Down

0 comments on commit 021e32e

Please sign in to comment.