Categories > TinyButStrong general >

Empty Fields after Update to PHP 5.4 - htmlspecialchars Bug

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Jost aus Soest
Date: 2012-12-04
Time: 10:43

Empty Fields after Update to PHP 5.4 - htmlspecialchars Bug

I had to update to PHP 5.4 and since than the output fields like [obj.field] are showing nothing, when the data for the field contains a special character (like an Umlaut "Ä").
But special characters coded in the templates are still shown.

I've searched for the reason and have found, that with PHP 5.4 the default charset is changed to UTF-8 (and not ISO-8859-1):
https://bugs.php.net/bug.php?id=61354 ==> htmlspecialchars() deliviers empty strings!?!

But till now I haven't found an easy workaround to deal with this problem.

So, what can I do?
All my TBS-websites are envolved with so many templates, so to add some modifier to all the [obj.field]-outputs is not a viable option.
Hint: All the data is stored in thousands of text files.

Is there a config-option in TBS to deal with this problem?

...

OK, I finally found the solution!
As information for others (lost like me) here the solution:
$TBS->LoadTemplate('frame.htm', false); // charset false = non convert special characters

:o)
By: Skrol29
Date: 2012-12-04
Time: 17:19

Re: Empty Fields after Update to PHP 5.4 - htmlspecialchars Bug

Thanks for the PHP 4 information and the tip :-)