You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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;
}
Steps to reproduce
setValue('score', '0');
...
### PHPWord version(s) where the bug happened
1.3.0
### PHP version(s) where the bug happened
8.3
### Priority
- [ ] I want to crowdfund the bug fix (with [@algora-io](https://docs.algora.io/bounties/overview)) and fund a community developer.
- [ ] I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)
The text was updated successfully, but these errors were encountered:
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;
}
Steps to reproduce
setValue('score', '0'); ... ### PHPWord version(s) where the bug happened 1.3.0 ### PHP version(s) where the bug happened 8.3 ### Priority - [ ] I want to crowdfund the bug fix (with [@algora-io](https://docs.algora.io/bounties/overview)) and fund a community developer. - [ ] I want to pay the bug fix and fund a maintainer for that. (Contact @Progi1984)The text was updated successfully, but these errors were encountered: