From f212bb96b353472a4f6c7ac5e27d1724a8980a4c Mon Sep 17 00:00:00 2001 From: colemanw Date: Fri, 21 Jul 2023 20:08:59 -0700 Subject: [PATCH] (REF) Replace CRM_Utils_Array in context of munge() --- CRM/Admin/Page/AJAX.php | 2 +- CRM/Utils/File.php | 4 ++-- CRM/Utils/REST.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CRM/Admin/Page/AJAX.php b/CRM/Admin/Page/AJAX.php index 1493c156c2..9d0c9ca2cb 100644 --- a/CRM/Admin/Page/AJAX.php +++ b/CRM/Admin/Page/AJAX.php @@ -70,7 +70,7 @@ class CRM_Admin_Page_AJAX { if (!empty($props['label'])) { $item['label'] = _ts($props['label'], ['context' => 'menu']); } - $item['name'] = !empty($props['name']) ? $props['name'] : CRM_Utils_String::munge(CRM_Utils_Array::value('label', $props)); + $item['name'] = !empty($props['name']) ? $props['name'] : CRM_Utils_String::munge($props['label'] ?? ''); if (!empty($item['child'])) { self::formatMenuItems($item['child']); } diff --git a/CRM/Utils/File.php b/CRM/Utils/File.php index a822f32c6f..f9c665b85a 100644 --- a/CRM/Utils/File.php +++ b/CRM/Utils/File.php @@ -423,10 +423,10 @@ class CRM_Utils_File { // munge extension so it cannot have an embbeded dot in it // The maximum length of a filename for most filesystems is 255 chars. // We'll truncate at 240 to give some room for the extension. - return CRM_Utils_String::munge("{$basename}_" . CRM_Utils_Array::value('extension', $info) . "_{$uniqID}", '_', 240) . ".unknown"; + return CRM_Utils_String::munge("{$basename}_" . ($info['extension'] ?? '') . "_{$uniqID}", '_', 240) . ".unknown"; } else { - return CRM_Utils_String::munge("{$basename}_{$uniqID}", '_', 240) . "." . CRM_Utils_Array::value('extension', $info); + return CRM_Utils_String::munge("{$basename}_{$uniqID}", '_', 240) . "." . ($info['extension'] ?? ''); } } diff --git a/CRM/Utils/REST.php b/CRM/Utils/REST.php index 0500b0d0c9..f6a119c59d 100644 --- a/CRM/Utils/REST.php +++ b/CRM/Utils/REST.php @@ -445,8 +445,8 @@ class CRM_Utils_REST { if (!empty($requestParams['json'])) { $params = json_decode($requestParams['json'], TRUE); } - $entity = CRM_Utils_String::munge(CRM_Utils_Array::value('entity', $requestParams)); - $action = CRM_Utils_String::munge(CRM_Utils_Array::value('action', $requestParams)); + $entity = CRM_Utils_String::munge($requestParams['entity'] ?? ''); + $action = CRM_Utils_String::munge($requestParams['action'] ?? ''); if (!is_array($params)) { CRM_Utils_JSON::output([ 'is_error' => 1, -- 2.25.1