From 5ba03ac7e3122db73f69d508f66de646219e2156 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Thu, 26 May 2022 00:51:31 -0400 Subject: [PATCH] check null first --- CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php b/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php index 925acbe52b..2428043a0a 100644 --- a/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php +++ b/CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php @@ -19,13 +19,14 @@ * @return integer */ function smarty_modifier_crmCountCharacters($string, $include_spaces = FALSE) { + if (is_null($string)) { + return 0; + } + if ($include_spaces) { return(strlen($string)); } - if (is_null($string)) { - return 0; - } return preg_match_all("/[^\s]/", $string, $match); } -- 2.25.1