-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TemplateProcessor.php print empty '' string if value is 0 #2572
Comments
I also encountered a similar problem, and I haven't been able to solve it yet. |
my way to solve it: |
Thanks @truestealth - works great! |
As a workaround, you could prepend the $templateProcessor->setValue('test', mb_chr(hexdec('FEFF')) . '0'); |
I encountered a similar issue when trying to pass a string "0" to the template processor, and eventually fixed it by adding a zero width space character to the string, so it doesn't get evaluated as false-y thus reducing it to an empty string:
|
+1, we are running into this issue as well. Hope the fix gets merged soon. Thank you all for your workarounds. |
Thanks, works like a charm! Bump for a fix |
Thanks, it works, while |
PHPWord/src/PhpWord/TemplateProcessor.php
Line 272 in 8b891bb
return $subject ? Text::toUTF8($subject) : '';
Cause issue if subject is 0, that actually i want to print,
but unfortunately when $subject=0 as string or int or char it results in false.
Please fix this issue
The text was updated successfully, but these errors were encountered: