Skip to content

Commit

Permalink
[PHP Deprecation] trim(): Passing null to parameter #1 () of type str…
Browse files Browse the repository at this point in the history
…ing is deprecated
  • Loading branch information
colemanw committed Jul 21, 2023
1 parent 77d7f7b commit 6075598
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/RelationshipType.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function postProcess() {
$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;
}

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Page/AJAX.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ public static function checkUserName() {
}

$config = CRM_Core_Config::singleton();
$username = trim(CRM_Utils_Array::value('cms_name', $_REQUEST));
$username = trim($_REQUEST['cms_name'] ?? '');

$params = ['name' => $username];

Expand Down
2 changes: 1 addition & 1 deletion CRM/Contribute/Form/ContributionPage/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function formRule($fields, $files, $options) {
// 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');
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Custom/Form/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ public function postProcess() {

$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'])) {
Expand Down
6 changes: 3 additions & 3 deletions CRM/Utils/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ public static function authenticateAbort($message, $abort) {
*/
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);

Expand Down Expand Up @@ -701,8 +701,8 @@ public static function authenticateScript($abort = TRUE, $name = NULL, $pass = N
// 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
Expand Down
4 changes: 2 additions & 2 deletions CRM/Utils/System/Backdrop.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,8 @@ public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE
$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);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Utils/System/Drupal.php
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,8 @@ public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE
$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);
Expand Down
4 changes: 2 additions & 2 deletions CRM/Utils/System/WordPress.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ public function loadBootStrap($params = [], $loadUser = TRUE, $throwError = TRUE
// 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) {
Expand Down

0 comments on commit 6075598

Please sign in to comment.