summaryrefslogtreecommitdiff
path: root/tests/basic
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2015-02-03 19:00:13 +0900
committerYasuo Ohgaki <yohgaki@php.net>2015-02-03 19:00:13 +0900
commitfeef180e6c7eef8f7345d1a823d62e219e6b35e3 (patch)
tree46ade3b3fb224e377c45ac104e257e6e49a5f234 /tests/basic
parent30b4a32e09a0bc142ecd7002f0a6eba710a4e997 (diff)
parent436ba1c4886024278337a8fe446c05a0629e4215 (diff)
downloadphp-git-feef180e6c7eef8f7345d1a823d62e219e6b35e3.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: Fixed Bug #67988 htmlspecialchars() does not respect default_charset specified by ini_set. Conflicts: main/main.c tests/basic/encoding.phpt
Diffstat (limited to 'tests/basic')
-rw-r--r--tests/basic/bug67988.phpt27
-rw-r--r--tests/basic/encoding.phpt14
2 files changed, 34 insertions, 7 deletions
diff --git a/tests/basic/bug67988.phpt b/tests/basic/bug67988.phpt
new file mode 100644
index 0000000000..e1d8e5d7d4
--- /dev/null
+++ b/tests/basic/bug67988.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #67988 (htmlspecialchars() does not respect default_charset specified by ini_set)
+--INI--
+default_charset=UTF-8
+--FILE--
+<?php
+ini_set('default_charset', 'cp1252');
+
+var_dump(ini_get('default_charset'));
+var_dump(ini_get('internal_encoding'));
+var_dump(ini_get('input_encoding'));
+var_dump(ini_get('output_encoding'));
+
+var_dump(htmlentities("\xA3", ENT_HTML5));
+var_dump(htmlentities("\xA3", ENT_HTML5, 'cp1252'));
+
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5)));
+var_dump(bin2hex(html_entity_decode("&pound;", ENT_HTML5, 'cp1252')));
+--EXPECT--
+string(6) "cp1252"
+string(0) ""
+string(0) ""
+string(0) ""
+string(7) "&pound;"
+string(7) "&pound;"
+string(2) "a3"
+string(2) "a3"
diff --git a/tests/basic/encoding.phpt b/tests/basic/encoding.phpt
index d9f7e0caad..c513cbfa79 100644
--- a/tests/basic/encoding.phpt
+++ b/tests/basic/encoding.phpt
@@ -14,14 +14,14 @@ var_dump(ini_get('input_encoding'));
var_dump(ini_get('internal_encoding'));
var_dump(ini_get('output_encoding'));
-var_dump(ini_set('input_encoding', 'ISO-8859-1'));
-var_dump(ini_set('internal_encoding', 'ISO-8859-1'));
-var_dump(ini_set('output_encoding', 'ISO-8859-1'));
+var_dump(ini_set('input_encoding', 'EUC-JP'));
+var_dump(ini_set('internal_encoding', 'EUC-JP'));
+var_dump(ini_set('output_encoding', 'EUC-JP'));
var_dump(ini_get('input_encoding'));
var_dump(ini_get('internal_encoding'));
var_dump(ini_get('output_encoding'));
---EXPECTF--
+--EXPECT--
string(5) "UTF-8"
string(0) ""
string(0) ""
@@ -34,6 +34,6 @@ string(0) ""
string(0) ""
string(0) ""
string(0) ""
-string(10) "ISO-8859-1"
-string(10) "ISO-8859-1"
-string(10) "ISO-8859-1"
+string(6) "EUC-JP"
+string(6) "EUC-JP"
+string(6) "EUC-JP"