From 329e034e18c3d2aaf2558e98e848f1f7dc751d7c Mon Sep 17 00:00:00 2001
From: Bharath Kumar Kondeti
 <57023-bharath_kondeti@users.noreply.drupalcode.org>
Date: Wed, 22 Nov 2023 00:06:51 +0000
Subject: [PATCH] Issue #3376831 by bharath-kondeti, Igumnov_aleksey, Jay
 Jangid, akshay.singh, Anybody: PHP 8.1 Deprecated function: preg_split():
 Passing null to parameter #3 ($limit) of type int is deprecated in
 smart_trim_field_formatter_view()

---
 smart_trim.module | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/smart_trim.module b/smart_trim.module
index f4422c9..6adfac8 100644
--- a/smart_trim.module
+++ b/smart_trim.module
@@ -88,7 +88,7 @@ function smart_trim_field_formatter_view($entity_type, $entity, $field, $instanc
             // Only bother with this is we have to.
             if ($settings['trim_length'] < str_word_count($output)) {
               // Use \s or use PREG_CLASS_UNICODE_WORD_BOUNDARY?
-              $words = preg_split('/\s/', $output, NULL, PREG_SPLIT_NO_EMPTY);
+              $words = preg_split('/\s/', $output, -1, PREG_SPLIT_NO_EMPTY);
               $output2 = implode(" ", array_slice($words, 0, $settings['trim_length']));
               $output2 = _filter_htmlcorrector($output2);
             }
-- 
GitLab