Edit report at https://bugs.php.net/bug.php?id=61354&edit=1
ID: 61354
Comment by: goodwaiter at gmail dot com
Reported by: hufeng1987 at gmail dot com
Summary: htmlentities and htmlspecialchars doesn't respect
the default_charset
Status: Not a bug
Type: Bug
Package: Strings related
Operating System: Linux/Windows/
PHP Version: 5.4.0
Block user comment: N
Private report: N
New Comment:
è½ç¶æ´æ¢å°é线ç¨å®å
¨çæ¬è½è§£å³é®é¢ï¼ä½æ¯é¾ä¿ä¸æ¬¡çæ¬ï¼PHPä¸ä¼æé线ç¨å®å
¨çæ¬çæ£å¸¸è¡¨ç°å½ä½
BUGæ´æ°æï¼æä»¥æä»¬è¦è®©PHPç¥éè¿ç¡®å®æ¯ä¸ä¸ªBUGã
BUGçä¸æè¡¨è¿°å¾ç®åï¼
php.iniçDefault
encodingæè
mb-internal-encodingç设置ï¼å¯¹htmlspecialchars,
htmlentitiesæ æï¼è¿ä¸¤ä¸ªå½æ°é¡½å¼ºç使ç¨èªå·±çutf-8ï¼èªä»¥ä¸ºæ¯ã
æ´æµè¡ç表述æ¯ï¼
htmlspecialchars,
htmlentitiesç¬ç«ä½¿ç¨èªå·±çç¼ç ï¼è¿è¿åç»ä¸å¤§å±ï¼PHPè¯å®ä¸è½å®¹å¿è¿æ ·çå
å¨ï¼å¿
é¡»è¦é²é¤è¿ä¸ªBUG
Previous Comments:
------------------------------------------------------------------------
[2012-08-27 12:54:07] goodwaiter at gmail dot com
It's really a bug.
but we can fix this by a easy way(I'm use Windows):
just change you php from "Non Thread Safe" to "Thread Safe"
And everythings will be ok now.
------------------------------------------------------------------------
[2012-08-23 06:31:15] hufeng1987 at gmail dot com
though php 5.4.6 released, but these problem still exists.
do you really care the php developers?
------------------------------------------------------------------------
[2012-08-08 12:16:25] giodev at panozzo dot it
Yes, this is a HUGE problem for us also. We migrate a single server with a
single homemade application and we lost 3-4 hours to fix all htmlspecialchars()
and htmlentities() to force encoding back to ISO-8859-1.
And really, under these conditions we will never migrate other apps/servers to
PHP 5.4. Too much work to be done not only by us, but also by external
contractors and customer of hosting services.
It's a big cost both for us and for our customers.
------------------------------------------------------------------------
[2012-08-08 11:30:35] aheckmann at m-s dot de
We also have the problem with broken php code in 5.4.
It is really a huge amount of work, to switch old projects.
We scanned our source files and found over 25.000 lines with
htmlspecialchars(), not only written by us, also in many 3rd party libraries.
So we also can not switch these projects to php 5.4.
A solution to set the default encoding vi php.ini/ini_set() back to iso8859-1
would be great.
------------------------------------------------------------------------
[2012-05-19 16:46:03] wxiaoguang at gmail dot com
I consider this as a bug, too.
My old code using charsets other than utf-8/ISO-8859-1 is totally
broken by php5.4's new htmlspecialchars.
in php5.3: ISO-8859-1 doesn't break any charset.
in php5.4: gbk/gb2312 characters are broken and I get empty
strings after htmlspecialchars.
It's impossible to find all htmlspecialchars and add the 'utf-8'
parameter to them in old projects.
As a result, I can not upgrade to php5.4
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=61354
--
Edit this bug report at https://bugs.php.net/bug.php?id=61354&edit=1