From 4d03ddb973ed6f422885f2083db8685f21ab71df Mon Sep 17 00:00:00 2001 From: Justin Freeman Date: Fri, 24 Sep 2021 15:11:23 +1000 Subject: [PATCH] CIVICRM-1844 Remove all references to safe_mode, DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0 --- CRM/Activity/Import/Controller.php | 5 +---- CRM/Contact/Import/Controller.php | 5 +---- CRM/Contribute/Import/Controller.php | 5 +---- CRM/Core/Payment/Elavon.php | 2 +- CRM/Core/Payment/FirstData.php | 2 +- CRM/Core/Smarty.php | 8 +------- CRM/Custom/Import/Controller.php | 5 +---- CRM/Event/Import/Controller.php | 5 +---- CRM/Member/Import/Controller.php | 5 +---- CRM/Upgrade/Headless.php | 5 +---- CRM/Upgrade/Page/Upgrade.php | 5 +---- CRM/Utils/HttpClient.php | 2 +- api/v3/System/ini-whitelist.txt | 1 - bin/ContributionProcessor.php | 5 +---- ext/payflowpro/tests/phpunit/bootstrap.php | 1 - ext/search_kit/tests/phpunit/bootstrap.php | 1 - 16 files changed, 13 insertions(+), 49 deletions(-) diff --git a/CRM/Activity/Import/Controller.php b/CRM/Activity/Import/Controller.php index 8370776ea6..772c146200 100644 --- a/CRM/Activity/Import/Controller.php +++ b/CRM/Activity/Import/Controller.php @@ -26,10 +26,7 @@ class CRM_Activity_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Contact/Import/Controller.php b/CRM/Contact/Import/Controller.php index c965973ffe..da72132b1b 100644 --- a/CRM/Contact/Import/Controller.php +++ b/CRM/Contact/Import/Controller.php @@ -26,10 +26,7 @@ class CRM_Contact_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Contribute/Import/Controller.php b/CRM/Contribute/Import/Controller.php index b1582781f8..8ec9f32d1f 100644 --- a/CRM/Contribute/Import/Controller.php +++ b/CRM/Contribute/Import/Controller.php @@ -26,10 +26,7 @@ class CRM_Contribute_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Core/Payment/Elavon.php b/CRM/Core/Payment/Elavon.php index 596d8898ca..75e2a37d21 100644 --- a/CRM/Core/Payment/Elavon.php +++ b/CRM/Core/Payment/Elavon.php @@ -157,7 +157,7 @@ class CRM_Core_Payment_Elavon extends CRM_Core_Payment { // set this for debugging -look for output in apache error log //curl_setopt ($ch,CURLOPT_VERBOSE,1 ); // ensures any Location headers are followed - if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') { + if (ini_get('open_basedir') == '') { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); } diff --git a/CRM/Core/Payment/FirstData.php b/CRM/Core/Payment/FirstData.php index 5b5d6b1802..f6968c7e71 100644 --- a/CRM/Core/Payment/FirstData.php +++ b/CRM/Core/Payment/FirstData.php @@ -222,7 +222,7 @@ class CRM_Core_Payment_FirstData extends CRM_Core_Payment { curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 36000); // ensures any Location headers are followed - if (ini_get('open_basedir') == '' && ini_get('safe_mode') == 'Off') { + if (ini_get('open_basedir') == '') { curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); } diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index 5c3afb207f..b73df97307 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -95,13 +95,7 @@ class CRM_Core_Smarty extends Smarty { exit(); } - //Check for safe mode CRM-2207 - if (ini_get('safe_mode')) { - $this->use_sub_dirs = FALSE; - } - else { - $this->use_sub_dirs = TRUE; - } + $this->use_sub_dirs = TRUE; $customPluginsDir = NULL; if (isset($config->customPHPPathDir)) { diff --git a/CRM/Custom/Import/Controller.php b/CRM/Custom/Import/Controller.php index c67e399031..0f740f59af 100644 --- a/CRM/Custom/Import/Controller.php +++ b/CRM/Custom/Import/Controller.php @@ -15,10 +15,7 @@ class CRM_Custom_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Event/Import/Controller.php b/CRM/Event/Import/Controller.php index baf5521a88..233b63231e 100644 --- a/CRM/Event/Import/Controller.php +++ b/CRM/Event/Import/Controller.php @@ -26,10 +26,7 @@ class CRM_Event_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Member/Import/Controller.php b/CRM/Member/Import/Controller.php index 2a57c0a381..b647e940e5 100644 --- a/CRM/Member/Import/Controller.php +++ b/CRM/Member/Import/Controller.php @@ -26,10 +26,7 @@ class CRM_Member_Import_Controller extends CRM_Core_Controller { public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal); - // lets get around the time limit issue if possible, CRM-2113 - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $this->_stateMachine = new CRM_Import_StateMachine($this, $action); diff --git a/CRM/Upgrade/Headless.php b/CRM/Upgrade/Headless.php index 0e1e869b0c..6bd63d32dd 100644 --- a/CRM/Upgrade/Headless.php +++ b/CRM/Upgrade/Headless.php @@ -25,10 +25,7 @@ class CRM_Upgrade_Headless { * - message: string, HTML-ish blob */ public function run($enablePrint = TRUE) { - // lets get around the time limit issue if possible for upgrades - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); $upgrade = new CRM_Upgrade_Form(); list($currentVer, $latestVer) = $upgrade->getUpgradeVersions(); diff --git a/CRM/Upgrade/Page/Upgrade.php b/CRM/Upgrade/Page/Upgrade.php index 06a377924c..5b71fed493 100644 --- a/CRM/Upgrade/Page/Upgrade.php +++ b/CRM/Upgrade/Page/Upgrade.php @@ -29,10 +29,7 @@ class CRM_Upgrade_Page_Upgrade extends CRM_Core_Page { * @throws \Exception */ public function run() { - // lets get around the time limit issue if possible for upgrades - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); Civi::resources()->addStyleFile('civicrm', 'css/admin.css'); diff --git a/CRM/Utils/HttpClient.php b/CRM/Utils/HttpClient.php index c2d12ae18c..0286c4f793 100644 --- a/CRM/Utils/HttpClient.php +++ b/CRM/Utils/HttpClient.php @@ -201,7 +201,7 @@ class CRM_Utils_HttpClient { * @return bool */ public function isRedirectSupported() { - return (ini_get('open_basedir') == '') && (ini_get('safe_mode') == 'Off' || ini_get('safe_mode') == '' || ini_get('safe_mode') === FALSE); + return (ini_get('open_basedir') == ''); } } diff --git a/api/v3/System/ini-whitelist.txt b/api/v3/System/ini-whitelist.txt index ab674b93fd..4e6dbabfd0 100644 --- a/api/v3/System/ini-whitelist.txt +++ b/api/v3/System/ini-whitelist.txt @@ -180,7 +180,6 @@ register_long_arrays report_memleaks report_zend_debug request_order -safe_mode # Omit: safe_mode_allowed_env_vars # Omit: safe_mode_exec_dir safe_mode_gid diff --git a/bin/ContributionProcessor.php b/bin/ContributionProcessor.php index a6c7bee51d..3de786f487 100644 --- a/bin/ContributionProcessor.php +++ b/bin/ContributionProcessor.php @@ -545,10 +545,7 @@ CRM_Core_Error::debug_log_message('ContributionProcessor.php'); $lock = Civi::lockManager()->acquire('worker.contribute.CiviContributeProcessor'); if ($lock->isAcquired()) { - // try to unset any time limits - if (!ini_get('safe_mode')) { - set_time_limit(0); - } + set_time_limit(0); CiviContributeProcessor::process(); } diff --git a/ext/payflowpro/tests/phpunit/bootstrap.php b/ext/payflowpro/tests/phpunit/bootstrap.php index a5b49253c8..5133778c81 100644 --- a/ext/payflowpro/tests/phpunit/bootstrap.php +++ b/ext/payflowpro/tests/phpunit/bootstrap.php @@ -1,7 +1,6 @@