Pluf Framework

Issue 806: /Pluf/Template.php

Reported by Jürgen Hörmann, May 8, 2012

Hello.

There is a problem with the htmspecialchars() call on line 232 of 
pluf/src/Pluf/Template.php

If the input string in $mixed contains German Umlauts or other 
non-ASCII chars that are NOT encoded in UTF, the call of 
htmlspecialchars will fail with this error:
htmlspecialchars(): Invalid multibyte sequence in argument

you have to validate the input before putting it into this function:

Replace in lines 232 and 236
htmlspecialchars($mixed, ENT_COMPAT, 'UTF-8')

with
htmlspecialchars(
    ((!mb_detect_encoding($mixed, 'UTF-8', true) ) 
    ? iconv(mb_detect_encoding($mixed, "auto", true), 
"UTF-8", $mixed) 
    : $mixed)
, ENT_COMPAT, 'UTF-8')

This works for me.

Created: 1 year 12 days ago by Jürgen Hörmann

Status: New

Labels:
Priority:Medium
Type:Defect