From f947589ddf79e47846cfb2771b55931227f2df5e Mon Sep 17 00:00:00 2001 From: Juan Aldasoro Date: Fri, 16 Jan 2026 13:40:17 +0100 Subject: [PATCH] Fix null handling in preg_replace calls. --- includes/helpers.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/helpers.php b/includes/helpers.php index d5aec18a..00ee760d 100644 --- a/includes/helpers.php +++ b/includes/helpers.php @@ -45,16 +45,16 @@ function normalize_content( string $content ): string { $content = (string) apply_filters( 'ai_experiments_pre_normalize_content', $content ); // Strip HTML entities. - $content = preg_replace( '/&#?[a-z0-9]{2,8};/i', '', $content ); + $content = preg_replace( '/&#?[a-z0-9]{2,8};/i', '', $content ) ?? $content; // Replace HTML linebreaks with newlines. - $content = preg_replace( '##', "\n\n", (string) $content ); + $content = preg_replace( '##', "\n\n", $content ) ?? $content; // Strip all HTML tags. $content = wp_strip_all_tags( (string) $content ); // Remove unrendered shortcode tags. - $content = preg_replace( '#\[.+\](.+)\[/.+\]#', '$1', $content ); + $content = preg_replace( '#\[.+\](.+)\[/.+\]#', '$1', $content ) ?? $content; /** * Filters the normalized content to allow for additional cleanup.