1--TEST--
2Test default_charset handling
3--SKIPIF--
4<?php
5extension_loaded('iconv') or die('skip');
6function_exists('iconv_get_encoding') or die("skip iconv_get_encoding() is not available in this build");
7?>
8--INI--
9error_reporting=E_ALL & ~E_DEPRECATED
10default_charset=UTF-8
11internal_encoding=
12input_encoding=
13output_encoding=
14iconv.internal_encoding=
15iconv.input_encoding=
16iconv.output_encoding=
17--FILE--
18<?php
19echo "*** Testing default_charset handling ***\n";
20
21echo "--- Get php.ini values ---\n";
22var_dump(ini_get('default_charset'),
23		 ini_get('internal_encoding'),
24		 ini_get('input_encoding'),
25		 ini_get('output_encoding'),
26		 ini_get('iconv.internal_encoding'),
27		 ini_get('iconv.input_encoding'),
28		 ini_get('iconv.output_encoding'));
29
30echo "\n--- Altering encodings ---\n";
31var_dump(ini_set('default_charset', 'ISO-8859-1'));
32
33echo "\n--- results of alterations ---\n";
34var_dump(ini_get('default_charset'),
35		 ini_get('internal_encoding'),
36		 ini_get('input_encoding'),
37		 ini_get('output_encoding'),
38		 ini_get('iconv.internal_encoding'),
39		 ini_get('iconv.input_encoding'),
40		 ini_get('iconv.output_encoding'));
41
42/*
43echo "\n--- Altering encodings ---\n";
44var_dump(ini_set('default_charset', 'ISO-8859-1'),
45		 ini_set('internal_encoding'),
46		 ini_set('input_encoding'),
47		 ini_set('output_encoding'),
48		 ini_set('iconv.internal_encoding'),
49		 ini_set('iconv.input_encoding'),
50		 ini_set('iconv.output_encoding'));
51*/
52
53echo "Done";
54?>
55--EXPECTF--
56*** Testing default_charset handling ***
57--- Get php.ini values ---
58string(5) "UTF-8"
59string(0) ""
60string(0) ""
61string(0) ""
62string(0) ""
63string(0) ""
64string(0) ""
65
66--- Altering encodings ---
67string(5) "UTF-8"
68
69--- results of alterations ---
70string(10) "ISO-8859-1"
71string(0) ""
72string(0) ""
73string(0) ""
74string(0) ""
75string(0) ""
76string(0) ""
77Done
78