Bug #67988 [Opn]: htmlspecialchars() does not respect default_charset specified by ini_set

From: Date: Sat, 20 Dec 2014 10:43:37 +0000
Subject: Bug #67988 [Opn]: htmlspecialchars() does not respect default_charset specified by ini_set
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189143@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67988&edit=1

 ID:                 67988
 User updated by:    xela at xela dot org dot ua
 Reported by:        xela at xela dot org dot ua
 Summary:            htmlspecialchars() does not respect default_charset
                     specified by ini_set
 Status:             Open
 Type:               Bug
 Package:            Strings related
-Operating System:   CentOS Linux 6.5
+Operating System:   CentOS Linux 6.6
-PHP Version:        5.6.3
+PHP Version:        5.6.4
 Block user comment: N
 Private report:     N

 New Comment:

Still exists in 5.6.4


Previous Comments:
------------------------------------------------------------------------
[2014-12-08 15:29:43] xela at xela dot org dot ua

Still exists in 5.6.3

------------------------------------------------------------------------
[2014-11-16 22:48:04] xela at xela dot org dot ua

Still exists in 5.6.2

------------------------------------------------------------------------
[2014-09-09 09:45:42] xela at xela dot org dot ua

Description:
------------
htmlspecialchars() does not respect default_charset specified by ini_set or php_value passed to
php-fpm, however it does while it is set by php.ini.

Test script:
---------------
<?php
ini_set('default_charset', 'cp1252');

var_dump(htmlentities("\xA3", ENT_HTML5));
var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));

var_dump(html_entity_decode("&pound;", ENT_HTML5));
var_dump(html_entity_decode("&pound;", ENT_HTML5, 'cp1252'));


Expected result:
----------------
Script should print:

string(7) "&pound;"
string(7) "&pound;"
string(1) "▒"
string(1) "▒"


Actual result:
--------------
Script printed:

string(0) ""
string(7) "&pound;"
string(2) "£"
string(1) "▒"



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67988&edit=1


Thread (10 messages)

« previous php.bugs (#189143) next »