From e2931be87e43ba91453e730e5b9c2f66050c7d8c Mon Sep 17 00:00:00 2001 From: Jan Linhart Date: Thu, 12 Mar 2015 12:01:27 +0100 Subject: [PATCH 1/2] Prevented PHP error: CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set --- lib/Mautic/Auth/OAuth.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Mautic/Auth/OAuth.php b/lib/Mautic/Auth/OAuth.php index 86e318cc..d32bd12b 100755 --- a/lib/Mautic/Auth/OAuth.php +++ b/lib/Mautic/Auth/OAuth.php @@ -623,10 +623,16 @@ public function makeRequest ($url, array $parameters = array(), $method = 'GET', CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, - CURLOPT_HEADER => true, - CURLOPT_FOLLOWLOCATION => true + CURLOPT_HEADER => true ); + // CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set + if (ini_get('open_basedir')) { + $options[CURLOPT_HTTPHEADER] = true; + } else { + $options[CURLOPT_HTTPHEADER] = false; + } + //Set CURL headers for oauth 1.0 requests if ($this->isOauth1()) { $options[CURLOPT_HTTPHEADER] = $header; From 2e2c1cc53c15e099a9204c19393a59ff1b46b508 Mon Sep 17 00:00:00 2001 From: Jan Linhart Date: Thu, 12 Mar 2015 16:33:04 +0100 Subject: [PATCH 2/2] Correction of previous commit about CURLOPT_FOLLOWLOCATION --- lib/Mautic/Auth/OAuth.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Mautic/Auth/OAuth.php b/lib/Mautic/Auth/OAuth.php index d32bd12b..e30df2eb 100755 --- a/lib/Mautic/Auth/OAuth.php +++ b/lib/Mautic/Auth/OAuth.php @@ -628,9 +628,9 @@ public function makeRequest ($url, array $parameters = array(), $method = 'GET', // CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set if (ini_get('open_basedir')) { - $options[CURLOPT_HTTPHEADER] = true; + $options[CURLOPT_FOLLOWLOCATION] = false; } else { - $options[CURLOPT_HTTPHEADER] = false; + $options[CURLOPT_FOLLOWLOCATION] = true; } //Set CURL headers for oauth 1.0 requests