[PHP Deprecation] trim(): Passing null to parameter #1 () of type string is deprecated
authorcolemanw <coleman@civicrm.org>
Fri, 21 Jul 2023 15:34:31 +0000 (11:34 -0400)
committercolemanw <coleman@civicrm.org>
Fri, 21 Jul 2023 15:34:31 +0000 (11:34 -0400)
CRM/Admin/Form/RelationshipType.php
CRM/Contact/Page/AJAX.php
CRM/Contribute/Form/ContributionPage/ThankYou.php
CRM/Custom/Form/Field.php
CRM/Utils/System.php
CRM/Utils/System/Backdrop.php
CRM/Utils/System/Drupal.php
CRM/Utils/System/WordPress.php

index a44d987eb3da1b7c352bed9b5bed0b6a535ac4cf..391b52304c47b7324bd2094c0f78cf5e99b69e82 100644 (file)
@@ -162,7 +162,7 @@ class CRM_Admin_Form_RelationshipType extends CRM_Admin_Form {
       $params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'null';
       $params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'null';
 
-      if (!strlen(trim(CRM_Utils_Array::value('label_b_a', $params)))) {
+      if (!strlen(trim($params['label_b_a'] ?? ''))) {
         $params['label_b_a'] = $params['label_a_b'] ?? NULL;
       }
 
index f09be9d63c1ddf6cada130a4da8acaaf5ac7002b..99181e9276a9a768e43889639afe29ccc2caf4a1 100644 (file)
@@ -324,7 +324,7 @@ class CRM_Contact_Page_AJAX {
     }
 
     $config = CRM_Core_Config::singleton();
-    $username = trim(CRM_Utils_Array::value('cms_name', $_REQUEST));
+    $username = trim($_REQUEST['cms_name'] ?? '');
 
     $params = ['name' => $username];
 
index 11dde185b6cbdeb8f98f846cceaba661ff473e09..f8cc668f07015c60061073306661c2b8b0c91240 100644 (file)
@@ -84,7 +84,7 @@ class CRM_Contribute_Form_ContributionPage_ThankYou extends CRM_Contribute_Form_
     // if is_email_receipt is set, the receipt message must be non-empty
     if (!empty($fields['is_email_receipt'])) {
       //added for CRM-1348
-      $email = trim(CRM_Utils_Array::value('receipt_from_email', $fields));
+      $email = trim($fields['receipt_from_email'] ?? '');
       if (empty($email) || !CRM_Utils_Rule::email($email)) {
         $errors['receipt_from_email'] = ts('A valid Receipt From Email address must be specified if Email Receipt to Contributor is enabled');
       }
index 9f829ac9ddc0224e93e7845103b87e84f47df13f..a61292f666d6054aef5b12ba474127bcf1931620 100644 (file)
@@ -863,7 +863,7 @@ AND    option_group_id = %2";
 
     $filter = 'null';
     if ($params['data_type'] == 'ContactReference' && !empty($params['filter_selected'])) {
-      if ($params['filter_selected'] == 'Advance' && trim(CRM_Utils_Array::value('filter', $params))) {
+      if ($params['filter_selected'] == 'Advance' && trim($params['filter'] ?? '')) {
         $filter = trim($params['filter']);
       }
       elseif ($params['filter_selected'] == 'Group' && !empty($params['group_id'])) {
index 641cf3ae15d9c33b8e8aec332be80ab05180a0ff..42eb98d4d6d8d5346a4f57daff5c2c67e1cd2e82 100644 (file)
@@ -648,7 +648,7 @@ class CRM_Utils_System {
    */
   public static function authenticateKey($abort = TRUE) {
     // also make sure the key is sent and is valid
-    $key = trim(CRM_Utils_Array::value('key', $_REQUEST));
+    $key = trim($_REQUEST['key'] ?? '');
 
     $docAdd = "More info at: " . CRM_Utils_System::docURL2('sysadmin/setup/jobs', TRUE);
 
@@ -701,8 +701,8 @@ class CRM_Utils_System {
     // auth to make sure the user has a login/password to do a shell operation
     // later on we'll link this to acl's
     if (!$name) {
-      $name = trim(CRM_Utils_Array::value('name', $_REQUEST));
-      $pass = trim(CRM_Utils_Array::value('pass', $_REQUEST));
+      $name = trim($_REQUEST['name'] ?? '');
+      $pass = trim($_REQUEST['pass'] ?? '');
     }
 
     // its ok to have an empty password
index 5cd20354ccfe34057748fa9d74374f53d98659b5..d8d1b8636f66a390c4fd2a12204a5740bcff6567 100644 (file)
@@ -605,8 +605,8 @@ AND    u.status = 1
     $uid = $params['uid'] ?? NULL;
     if (!$uid) {
       // Load the user we need to check Backdrop permissions.
-      $name = CRM_Utils_Array::value('name', $params, FALSE) ? $params['name'] : trim(CRM_Utils_Array::value('name', $_REQUEST));
-      $pass = CRM_Utils_Array::value('pass', $params, FALSE) ? $params['pass'] : trim(CRM_Utils_Array::value('pass', $_REQUEST));
+      $name = !empty($params['name']) ? $params['name'] : trim($_REQUEST['name'] ?? '');
+      $pass = !empty($params['pass']) ? $params['pass'] : trim($_REQUEST['pass'] ?? '');
 
       if ($name) {
         $uid = user_authenticate($name, $pass);
index ed8907df964d3dc1508d5a0534588080a9473258..756b78ec29834f78b21bc70a6e45992314dba466 100644 (file)
@@ -522,8 +522,8 @@ AND    u.status = 1
     $uid = $params['uid'] ?? NULL;
     if (!$uid) {
       //load user, we need to check drupal permissions.
-      $name = CRM_Utils_Array::value('name', $params, FALSE) ? $params['name'] : trim(CRM_Utils_Array::value('name', $_REQUEST));
-      $pass = CRM_Utils_Array::value('pass', $params, FALSE) ? $params['pass'] : trim(CRM_Utils_Array::value('pass', $_REQUEST));
+      $name = !empty($params['name']) ? $params['name'] : trim($_REQUEST['name'] ?? '');
+      $pass = !empty($params['pass']) ? $params['pass'] : trim($_REQUEST['pass'] ?? '');
 
       if ($name) {
         $uid = user_authenticate($name, $pass);
index 0ea69aaa9a240d14f914fe3f9804fdbf67cb2c93..a8ec22789340a505b5ba9b5bc5face6b9604095a 100644 (file)
@@ -762,8 +762,8 @@ class CRM_Utils_System_WordPress extends CRM_Utils_System_Base {
     // Maybe login user.
     $uid = $params['uid'] ?? NULL;
     if (!$uid) {
-      $name = $name ? $name : trim(CRM_Utils_Array::value('name', $_REQUEST));
-      $pass = $pass ? $pass : trim(CRM_Utils_Array::value('pass', $_REQUEST));
+      $name = $name ?: trim($_REQUEST['name'] ?? '');
+      $pass = $pass ?: trim($_REQUEST['pass'] ?? '');
       if ($name) {
         $uid = wp_authenticate($name, $pass);
         if (!$uid) {