Skip to content

Commit 93e16d4

Browse files
authored
Merge pull request #2292 from neopheus/php8.1-fix-2290
Php 8.1 fix #2290
2 parents f853b9f + fa84160 commit 93e16d4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/PhpWord/Escaper/Xml.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ class Xml extends AbstractEscaper
2727
protected function escapeSingleValue($input)
2828
{
2929
// todo: omit encoding parameter after migration onto PHP 5.4
30-
return htmlspecialchars($input, ENT_QUOTES, 'UTF-8');
30+
return (!is_null($input)) ? htmlspecialchars($input, ENT_QUOTES, 'UTF-8') : '';
3131
}
3232
}

src/PhpWord/TemplateProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,11 @@ protected static function ensureMacroCompleted($macro)
257257
*/
258258
protected static function ensureUtf8Encoded($subject)
259259
{
260-
if (!Text::isUTF8($subject)) {
260+
if (!Text::isUTF8($subject) && !is_null($subject)) {
261261
$subject = utf8_encode($subject);
262262
}
263263

264-
return $subject;
264+
return (!is_null($subject)) ? $subject : '';
265265
}
266266

267267
/**

0 commit comments

Comments
 (0)