Phalanger icon indicating copy to clipboard operation
Phalanger copied to clipboard

BUG with strings

Open kripper opened this issue 10 years ago • 2 comments

$val1 = 'é'; $val2 = unserialize(serialize($val1));

$EOL = "<br>\n";

echo ($val1 === $val2 ? 'Equal' : 'Not Equal') . $EOL; // Returns 'Equal', because $val1 === $val2 === 'é'
echo htmlentities($val1) . $EOL; // Returns html entity for 'é'
echo htmlentities($val2) . $EOL; // Returns '?' (Note that $val1 === $val2 !)

BTW: I'm using the ISO-8859-1 charset

kripper avatar Feb 19 '14 21:02 kripper

I would recommend to set UTF-8 encoding

jakubmisek avatar Feb 21 '14 13:02 jakubmisek

it does seem that this behaviour differs to php 5.5.9 (ubuntu 14.04) which outputs:

Equal<br>
&eacute;<br>
&eacute;<br>

lucyllewy avatar Aug 19 '16 22:08 lucyllewy