From f7ad20386414fec900da9bab94318a4d04679e39 Mon Sep 17 00:00:00 2001 From: eileen Date: Fri, 14 Feb 2020 09:32:54 +1300 Subject: [PATCH] Fix calls to Request::retrieve Do not pass in values that are set by default. Use retrieveValue rather than passing inn the NULL object --- CRM/Api4/Page/AJAX.php | 2 +- CRM/Contact/Page/Inline/CommunicationPreferences.php | 4 +++- CRM/Contact/Page/Inline/OpenID.php | 4 +++- CRM/Contact/Page/Inline/Phone.php | 4 +++- CRM/Contact/Page/Inline/Website.php | 4 +++- CRM/Contribute/Form/AdditionalPayment.php | 2 ++ CRM/Core/BAO/ConfigSetting.php | 3 +-- CRM/Core/BAO/Log.php | 2 ++ CRM/Core/Page/AJAX/Location.php | 2 ++ CRM/SMS/Controller/Send.php | 8 ++++---- 10 files changed, 24 insertions(+), 11 deletions(-) diff --git a/CRM/Api4/Page/AJAX.php b/CRM/Api4/Page/AJAX.php index da37b04682..94f9c329c7 100644 --- a/CRM/Api4/Page/AJAX.php +++ b/CRM/Api4/Page/AJAX.php @@ -65,7 +65,7 @@ class CRM_Api4_Page_AJAX extends CRM_Core_Page { try { // Call multiple if (empty($this->urlPath[3])) { - $calls = CRM_Utils_Request::retrieve('calls', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'POST', TRUE); + $calls = CRM_Utils_Request::retrieve('calls', 'String', CRM_Core_DAO::$_nullObject, TRUE, NULL, 'POST'); $calls = json_decode($calls, TRUE); $response = []; foreach ($calls as $index => $call) { diff --git a/CRM/Contact/Page/Inline/CommunicationPreferences.php b/CRM/Contact/Page/Inline/CommunicationPreferences.php index a5648cdd67..9b95964b01 100644 --- a/CRM/Contact/Page/Inline/CommunicationPreferences.php +++ b/CRM/Contact/Page/Inline/CommunicationPreferences.php @@ -24,10 +24,12 @@ class CRM_Contact_Page_Inline_CommunicationPreferences extends CRM_Core_Page { * Run the page. * * This method is called after the page is created. + * + * @throws \CRM_Core_Exception */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $params = ['id' => $contactId]; diff --git a/CRM/Contact/Page/Inline/OpenID.php b/CRM/Contact/Page/Inline/OpenID.php index 50897e0bc6..53e93e9f56 100644 --- a/CRM/Contact/Page/Inline/OpenID.php +++ b/CRM/Contact/Page/Inline/OpenID.php @@ -24,10 +24,12 @@ class CRM_Contact_Page_Inline_OpenID extends CRM_Core_Page { * Run the page. * * This method is called after the page is created. + * + * @throws \CRM_Core_Exception */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); diff --git a/CRM/Contact/Page/Inline/Phone.php b/CRM/Contact/Page/Inline/Phone.php index 478d1592ac..714c1c039d 100644 --- a/CRM/Contact/Page/Inline/Phone.php +++ b/CRM/Contact/Page/Inline/Phone.php @@ -24,10 +24,12 @@ class CRM_Contact_Page_Inline_Phone extends CRM_Core_Page { * Run the page. * * This method is called after the page is created. + * + * @throws \CRM_Core_Exception */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE); $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', ['labelColumn' => 'display_name']); $phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id'); diff --git a/CRM/Contact/Page/Inline/Website.php b/CRM/Contact/Page/Inline/Website.php index e1402c9677..de416295df 100644 --- a/CRM/Contact/Page/Inline/Website.php +++ b/CRM/Contact/Page/Inline/Website.php @@ -24,10 +24,12 @@ class CRM_Contact_Page_Inline_Website extends CRM_Core_Page { * Run the page. * * This method is called after the page is created. + * + * @throws \CRM_Core_Exception */ public function run() { // get the emails for this contact - $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST); + $contactId = CRM_Utils_Request::retrieveValue('cid', 'Positive'); $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'); diff --git a/CRM/Contribute/Form/AdditionalPayment.php b/CRM/Contribute/Form/AdditionalPayment.php index ee860de148..cf387bf944 100644 --- a/CRM/Contribute/Form/AdditionalPayment.php +++ b/CRM/Contribute/Form/AdditionalPayment.php @@ -167,6 +167,8 @@ class CRM_Contribute_Form_AdditionalPayment extends CRM_Contribute_Form_Abstract /** * Build the form object. + * + * @throws \CRM_Core_Exception */ public function buildQuickForm() { if ($this->_view == 'transaction' && ($this->_action & CRM_Core_Action::BROWSE)) { diff --git a/CRM/Core/BAO/ConfigSetting.php b/CRM/Core/BAO/ConfigSetting.php index 359685a8cf..e011e4e884 100644 --- a/CRM/Core/BAO/ConfigSetting.php +++ b/CRM/Core/BAO/ConfigSetting.php @@ -263,8 +263,7 @@ class CRM_Core_BAO_ConfigSetting { 'Boolean', CRM_Core_DAO::$_nullArray, FALSE, - FALSE, - 'REQUEST' + FALSE ); if ($config->userSystem->is_drupal && $resetSessionTable diff --git a/CRM/Core/BAO/Log.php b/CRM/Core/BAO/Log.php index 4fe04b8f1d..382fbb5c31 100644 --- a/CRM/Core/BAO/Log.php +++ b/CRM/Core/BAO/Log.php @@ -70,6 +70,8 @@ class CRM_Core_BAO_Log extends CRM_Core_DAO_Log { * @param string $tableName * @param int $tableID * @param int $userID + * + * @throws \CRM_Core_Exception */ public static function register( $contactID, diff --git a/CRM/Core/Page/AJAX/Location.php b/CRM/Core/Page/AJAX/Location.php index 5f0eeb5063..60a11fdd67 100644 --- a/CRM/Core/Page/AJAX/Location.php +++ b/CRM/Core/Page/AJAX/Location.php @@ -28,6 +28,8 @@ class CRM_Core_Page_AJAX_Location { * obtain the location of given contact-id. * This method is used by on-behalf-of form to dynamically generate poulate the * location field values for selected permissioned contact. + * + * @throws \CRM_Core_Exception */ public static function getPermissionedLocation() { $cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject, TRUE); diff --git a/CRM/SMS/Controller/Send.php b/CRM/SMS/Controller/Send.php index 116cc577ae..92627d38e9 100644 --- a/CRM/SMS/Controller/Send.php +++ b/CRM/SMS/Controller/Send.php @@ -22,16 +22,16 @@ class CRM_SMS_Controller_Send extends CRM_Core_Controller { * @param string $title * @param bool|int $action * @param bool $modal + * + * @throws \CRM_Core_Exception */ public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) { parent::__construct($title, $modal, NULL, FALSE, TRUE); - $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL); + $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this); // also get the text and html file - $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String', - CRM_Core_DAO::$_nullObject, FALSE, NULL - ); + $txtFile = CRM_Utils_Request::retrieveValue('txtFile', 'String'); $config = CRM_Core_Config::singleton(); if ($txtFile && -- 2.25.1