Problem with setValue function in TemplateProcessor
xlh2046 opened this issue · 0 comments
xlh2046 commented
Describe the bug and add attachments
When using the setValue function of the Template Processor class:
$templateProcessor->setValue('score', '0');
Expected behavior
I want to replace the score variable with 0,but the result was that the score variable was replaced with ''.
After checking the code, this function looks like this:
/**
* @param ?string $subject
*
* @return string
*/
protected static function ensureUtf8Encoded($subject)
{
return $subject ? Text::toUTF8($subject) : '';
}
I will change it as follows, local testing is possible. like this:
protected static function ensureUtf8Encoded($subject)
{
$subject = $subject??'';
return $subject ? Text::toUTF8($subject) : $subject;
}