From 7b244a288bb64c9cb407cb9a3d73360f4a230850 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 23 Feb 2023 13:11:52 -0800 Subject: [PATCH] mb_truncate - Save 0.00000001s If it's null, then we don't really have to call `$strlen()` or evaluate the `>` operation. --- CRM/Core/Smarty/plugins/modifier.mb_truncate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Core/Smarty/plugins/modifier.mb_truncate.php b/CRM/Core/Smarty/plugins/modifier.mb_truncate.php index 6f81841d42..e5416bc2bb 100644 --- a/CRM/Core/Smarty/plugins/modifier.mb_truncate.php +++ b/CRM/Core/Smarty/plugins/modifier.mb_truncate.php @@ -58,7 +58,7 @@ function smarty_modifier_mb_truncate($string, $length = 80, $etc = '...', } - if ($strlen($string ?: '') > $length) { + if ($string !== NULL && $strlen($string) > $length) { $length -= $strlen($etc); if (!$break_words) { $string = preg_replace('/\s+?(\S+)?$/', '', $substr($string, 0, $length + 1)); -- 2.25.1