From c10085c99e08828d042ef46808a8d6953ba5bd3d Mon Sep 17 00:00:00 2001 From: Alexandre Saelens Date: Tue, 23 Jan 2024 13:22:47 +1300 Subject: [PATCH] FIX: Make sureHtmlDiff::compareHTML is not passed null values --- src/VersionFeed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VersionFeed.php b/src/VersionFeed.php index ad7e1bc..9c7fb2c 100644 --- a/src/VersionFeed.php +++ b/src/VersionFeed.php @@ -94,7 +94,7 @@ class VersionFeed extends SiteTreeExtension if (isset($previous)) { // Produce the diff fields for use in the template. if ($version->Title != $previous->Title) { - $diffTitle = HtmlDiff::compareHTML($version->Title, $previous->Title); + $diffTitle = HtmlDiff::compareHTML($version->Title ?? '', $previous->Title ?? ''); $version->DiffTitle = DBField::create_field('HTMLText', null); $version->DiffTitle->setValue( @@ -107,7 +107,7 @@ class VersionFeed extends SiteTreeExtension } if ($version->Content != $previous->Content) { - $diffContent = HtmlDiff::compareHTML($version->Content, $previous->Content); + $diffContent = HtmlDiff::compareHTML($version->Content ?? '', $previous->Content ?? ''); $version->DiffContent = DBField::create_field('HTMLText', null); $version->DiffContent->setValue('
'.$diffContent.'
');