Fix calls to Request::retrieve
authoreileen <emcnaughton@wikimedia.org>
Thu, 13 Feb 2020 20:32:54 +0000 (09:32 +1300)
committereileen <emcnaughton@wikimedia.org>
Thu, 13 Feb 2020 20:44:40 +0000 (09:44 +1300)
Do not pass in values that are set by default. Use retrieveValue  rather than passing inn the NULL object

CRM/Api4/Page/AJAX.php
CRM/Contact/Page/Inline/CommunicationPreferences.php
CRM/Contact/Page/Inline/OpenID.php
CRM/Contact/Page/Inline/Phone.php
CRM/Contact/Page/Inline/Website.php
CRM/Contribute/Form/AdditionalPayment.php
CRM/Core/BAO/ConfigSetting.php
CRM/Core/BAO/Log.php
CRM/Core/Page/AJAX/Location.php
CRM/SMS/Controller/Send.php

index da37b04682985781db5a365fc20da5a20abb79d2..94f9c329c788b4e81c44e70a778281cff276ed47 100644 (file)
@@ -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) {
index a5648cdd677024a4af397bd676313ce8fe1393d5..9b95964b0191e8dc02cd7b413d8e33453d067b1d 100644 (file)
@@ -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];
 
index 50897e0bc65a4ab39b2041966e09966950d9ef55..53e93e9f5617cc5f878ab3263f90c4b487ae5b35 100644 (file)
@@ -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']);
 
index 478d1592ace1db4b54863d4046f24b40a037b1c6..714c1c039dd715a6132b5e524bd62453bc980c15 100644 (file)
@@ -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');
index e1402c96775781ecbcd4f49d6e7a4fea88ed9653..de416295df8da6c15cd918882ecc0771719c17fc 100644 (file)
@@ -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');
 
index ee860de148faacef9a46c178cacb3336b98f096a..cf387bf9444c5898cd3acac6b83eefeeaa2d9508 100644 (file)
@@ -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)) {
index 359685a8cf12a0605ff8d970403e709fe21332d6..e011e4e884eb28fa895bfa2f28957a4857c9211b 100644 (file)
@@ -263,8 +263,7 @@ class CRM_Core_BAO_ConfigSetting {
       'Boolean',
       CRM_Core_DAO::$_nullArray,
       FALSE,
-      FALSE,
-      'REQUEST'
+      FALSE
     );
     if ($config->userSystem->is_drupal &&
       $resetSessionTable
index 4fe04b8f1d0315522d164f9ea8512b8a49dcdd45..382fbb5c31678dd07d96bdc5aa5b4d63f80b897c 100644 (file)
@@ -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,
index 5f0eeb5063c4b3a24e51d9f5b834fb6abae41143..60a11fdd6789f63ee1d72097c68f7dabfd73bbfe 100644 (file)
@@ -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);
index 116cc577ae38fb06027c9c81aa9399336b6b7ce4..92627d38e9ed6e43861e3cc3266f494cc0fc3893 100644 (file)
@@ -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 &&