Skip to content

Commit

Permalink
Merge pull request #2292 from neopheus/php8.1-fix-2290
Browse files Browse the repository at this point in the history
Php 8.1 fix #2290
  • Loading branch information
PowerKiKi authored Sep 15, 2022
2 parents f853b9f + fa84160 commit 93e16d4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/PhpWord/Escaper/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ class Xml extends AbstractEscaper
protected function escapeSingleValue($input)
{
// todo: omit encoding parameter after migration onto PHP 5.4
return htmlspecialchars($input, ENT_QUOTES, 'UTF-8');
return (!is_null($input)) ? htmlspecialchars($input, ENT_QUOTES, 'UTF-8') : '';
}
}
4 changes: 2 additions & 2 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ protected static function ensureMacroCompleted($macro)
*/
protected static function ensureUtf8Encoded($subject)
{
if (!Text::isUTF8($subject)) {
if (!Text::isUTF8($subject) && !is_null($subject)) {
$subject = utf8_encode($subject);
}

return $subject;
return (!is_null($subject)) ? $subject : '';
}

/**
Expand Down

0 comments on commit 93e16d4

Please sign in to comment.