check null first
authordemeritcowboy <demeritcowboy@hotmail.com>
Thu, 26 May 2022 04:51:31 +0000 (00:51 -0400)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Thu, 26 May 2022 04:51:31 +0000 (00:51 -0400)
CRM/Core/Smarty/plugins/modifier.crmCountCharacters.php

index 925acbe52b809f0f19939f6ec24a4733aa9c9c29..2428043a0ac8f91075ec04d2b0a6fe6f355a192d 100644 (file)
  * @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);
 }