From e2187874dea5c15eeb063758d42f0987ceeed759 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 15 Nov 2022 17:08:11 -0500 Subject: [PATCH] Fix php notice preg_replace(): Passing null to parameter #3 () of type array|string is deprecated --- ext/afform/core/Civi/Afform/Tokens.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/afform/core/Civi/Afform/Tokens.php b/ext/afform/core/Civi/Afform/Tokens.php index bc12d8477a7b..7d291791e4b9 100644 --- a/ext/afform/core/Civi/Afform/Tokens.php +++ b/ext/afform/core/Civi/Afform/Tokens.php @@ -32,7 +32,9 @@ class Tokens { */ public static function applyCkeditorWorkaround(GenericHookEvent $e) { foreach (array_keys($e->content) as $field) { - $e->content[$field] = preg_replace(';https?://(\{afform.*Url\});', '$1', $e->content[$field]); + if (is_string($e->content[$field])) { + $e->content[$field] = preg_replace(';https?://(\{afform.*Url\});', '$1', $e->content[$field]); + } } }