|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patcheshtmlspecialchars.patch (last revision 2012-03-01 20:40 UTC by keisial at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-03-01 22:47 UTC] nikic@php.net
[2012-03-01 23:37 UTC] cataphract@php.net
-Status: Open
+Status: Wont fix
[2012-03-01 23:37 UTC] cataphract@php.net
[2012-03-02 00:29 UTC] keisial at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 10:00:01 2025 UTC |
Description: ------------ htmlspecialchars() no longer provides warnings in PHP 5.4 This is specially worrying as 5.4 changes its default charset from ISO-8859-1 to UTF-8. So the same string that passed flawlessly through 5.3, will now silently output nothing in 5.4 (and htmlspecialchars is one of the last things to check!). In 5.3 the following can produce: var_dump( htmlspecialchars("a\237a", ENT_COMPAT, 'UTF-8') ); PHP Warning: htmlspecialchars(): Invalid multibyte sequence in argument in php shell code on line 1 string(0) "" whereas in 5.4: var_dump( htmlspecialchars("a\237a", ENT_COMPAT, 'UTF-8') ); string(0) "" The explicit UTF-8 is to make both work the same, htmlspecialchars("a\237a") *works* in 5.3 (but it may not be in your page encoding). The reason is clear, php_error_docref() of php_escape_html_entities_ex is gone in 5.4 and trunk. I attach a patch against 5.4 branch readding the warning (should apply fine in trunk, moved 5 lines below)