From f64304936f9847e3b76c522692299fd5099af936 Mon Sep 17 00:00:00 2001 From: Florian CAVASIN Date: Thu, 30 May 2024 11:34:36 +0200 Subject: [PATCH 1/2] Fix `0` considered as empty string --- src/PhpWord/TemplateProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PhpWord/TemplateProcessor.php b/src/PhpWord/TemplateProcessor.php index 8aee40c546..22a144fbb9 100644 --- a/src/PhpWord/TemplateProcessor.php +++ b/src/PhpWord/TemplateProcessor.php @@ -269,7 +269,7 @@ protected static function ensureMacroCompleted($macro) */ protected static function ensureUtf8Encoded($subject) { - return $subject ? Text::toUTF8($subject) : ''; + return (null !== $subject) ? Text::toUTF8($subject) : ''; } /** From c6a956935fe00e73a95bbdd8eb230c56f2595380 Mon Sep 17 00:00:00 2001 From: Florian CAVASIN Date: Mon, 14 Oct 2024 09:23:43 +0200 Subject: [PATCH 2/2] Update changelog --- docs/changes/1.x/1.4.0.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/changes/1.x/1.4.0.md b/docs/changes/1.x/1.4.0.md index 8db845337d..3d2fa31535 100644 --- a/docs/changes/1.x/1.4.0.md +++ b/docs/changes/1.x/1.4.0.md @@ -18,3 +18,5 @@ - Add test case to make sure vMerge defaults to 'continue' by [@SpraxDev](https://github.com/SpraxDev) in [#2677](https://github.com/PHPOffice/PHPWord/pull/2677) ### BC Breaks + +- TemplateProcessor: Fix 0 considered as empty string. Fixing [#2572](https://github.com/PHPOffice/PHPWord/issues/2572) in [#2617](https://github.com/PHPOffice/PHPWord/pull/2617)