Merge pull request #2292 from neopheus/php8.1-fix-2290

Php 8.1 fix #2290
This commit is contained in:
Adrien Crivelli 2022-09-16 00:12:45 +02:00 committed by GitHub
commit 93e16d4001
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -27,6 +27,6 @@ class Xml extends AbstractEscaper
protected function escapeSingleValue($input) protected function escapeSingleValue($input)
{ {
// todo: omit encoding parameter after migration onto PHP 5.4 // 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') : '';
} }
} }

View File

@ -257,11 +257,11 @@ class TemplateProcessor
*/ */
protected static function ensureUtf8Encoded($subject) protected static function ensureUtf8Encoded($subject)
{ {
if (!Text::isUTF8($subject)) { if (!Text::isUTF8($subject) && !is_null($subject)) {
$subject = utf8_encode($subject); $subject = utf8_encode($subject);
} }
return $subject; return (!is_null($subject)) ? $subject : '';
} }
/** /**