#define GENERIC_SUPERSET_NBYTES 4
/* }}} */
-static PHP_INI_MH(OnUpdateStringIconvCharset)
+
+static PHP_INI_MH(OnUpdateInputEncoding)
+{
+ if (new_value_length >= ICONV_CSNMAXLEN) {
+ return FAILURE;
+ }
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, PG(input_encoding), strlen(PG(input_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+ return SUCCESS;
+}
+
+
+static PHP_INI_MH(OnUpdateOutputEncoding)
{
if(new_value_length >= ICONV_CSNMAXLEN) {
return FAILURE;
}
- OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, PG(output_encoding), strlen(PG(output_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
return SUCCESS;
}
+
+static PHP_INI_MH(OnUpdateInternalEncoding)
+{
+ if(new_value_length >= ICONV_CSNMAXLEN) {
+ return FAILURE;
+ }
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, PG(internal_encoding), strlen(PG(internal_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+ return SUCCESS;
+}
+
+
/* {{{ PHP_INI
*/
PHP_INI_BEGIN()
- STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, input_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, output_encoding, zend_iconv_globals, iconv_globals)
- STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, internal_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, zend_iconv_globals, iconv_globals)
+ STD_PHP_INI_ENTRY("iconv.internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, zend_iconv_globals, iconv_globals)
PHP_INI_END()
/* }}} */
#endif
#ifdef HAVE_IBM_ICONV
-# define ICONV_INPUT_ENCODING "ISO8859-1"
-# define ICONV_OUTPUT_ENCODING "ISO8859-1"
-# define ICONV_INTERNAL_ENCODING "ISO8859-1"
# define ICONV_ASCII_ENCODING "IBM-850"
# define ICONV_UCS4_ENCODING "UCS-4"
#else
-# define ICONV_INPUT_ENCODING "ISO-8859-1"
-# define ICONV_OUTPUT_ENCODING "ISO-8859-1"
-# define ICONV_INTERNAL_ENCODING "ISO-8859-1"
# define ICONV_ASCII_ENCODING "ASCII"
# define ICONV_UCS4_ENCODING "UCS-4LE"
#endif
--- /dev/null
+--TEST--
+Encoding INI test
+--SKIPIF--
+<?php extension_loaded('iconv') or die('skip mbstring not available'); ?>
+--INI--
+default_charset=ISO-8859-1
+internal_encoding=
+input_encoding=
+output_encoding=
+iconv.internal_encoding=ISO-8859-1
+iconv.http_input=ISO-8859-1
+iconv.http_output=ISO-8859-1
+--FILE--
+<?php
+echo "Getting INI\n";
+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(ini_get('iconv.internal_encoding'));
+var_dump(ini_get('iconv.input_encoding'));
+var_dump(ini_get('iconv.output_encoding'));
+
+echo "Setting INI\n";
+var_dump(ini_set('default_charset', 'UTF-8'));
+var_dump(ini_set('internal_encoding', 'UTF-8'));
+var_dump(ini_set('input_encoding', 'UTF-8'));
+var_dump(ini_set('output_encoding', 'UTF-8'));
+var_dump(ini_set('iconv.internal_encoding', 'UTF-8'));
+var_dump(ini_set('iconv.input_encoding', 'UTF-8'));
+var_dump(ini_set('iconv.output_encoding', 'UTF-8'));
+
+echo "Getting INI\n";
+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(ini_get('iconv.internal_encoding'));
+var_dump(ini_get('iconv.input_encoding'));
+var_dump(ini_get('iconv.output_encoding'));
+
+--EXPECT--
+Getting INI
+string(10) "ISO-8859-1"
+string(0) ""
+string(0) ""
+string(0) ""
+string(10) "ISO-8859-1"
+string(0) ""
+string(0) ""
+Setting INI
+string(10) "ISO-8859-1"
+string(0) ""
+string(0) ""
+string(0) ""
+string(10) "ISO-8859-1"
+string(0) ""
+string(0) ""
+Getting INI
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 11 --
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 12 --
bool(true)
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 14 --
bool(true)
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 16 --
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 17 --
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 18 --
bool(true)
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 23 --
bool(true)
bool(true)
bool(true)
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
-- Iteration 24 --
Warning: iconv_set_encoding() expects parameter 2 to be string, resource given in %s on line %d
NULL
-string(0) ""
-string(0) ""
-string(0) ""
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
Done
\ No newline at end of file
if (MBSTRG(http_input_list)) {
pefree(MBSTRG(http_input_list), 1);
}
+ if (SUCCESS == php_mb_parse_encoding_list(PG(input_encoding), strlen(PG(input_encoding))+1, &list, &size, 1 TSRMLS_CC)) {
+ MBSTRG(http_input_list) = list;
+ MBSTRG(http_input_list_size) = 0;
+ return SUCCESS;
+ }
MBSTRG(http_input_list) = NULL;
MBSTRG(http_input_list_size) = 0;
return SUCCESS;
const mbfl_encoding *encoding;
if (new_value == NULL || new_value_length == 0) {
- MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
- MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
- return SUCCESS;
- }
-
- encoding = mbfl_name2encoding(new_value);
- if (!encoding) {
- MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
- MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
- return FAILURE;
+ encoding = mbfl_name2encoding(PG(output_encoding));
+ if (!encoding) {
+ MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
+ MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
+ return SUCCESS;
+ }
+ } else {
+ encoding = mbfl_name2encoding(new_value);
+ if (!encoding) {
+ MBSTRG(http_output_encoding) = &mbfl_encoding_pass;
+ MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass;
+ return FAILURE;
+ }
}
-
MBSTRG(http_output_encoding) = encoding;
MBSTRG(current_http_output_encoding) = encoding;
return SUCCESS;
const mbfl_encoding *encoding;
if (!new_value || new_value_length == 0 || !(encoding = mbfl_name2encoding(new_value))) {
- switch (MBSTRG(language)) {
- case mbfl_no_language_uni:
- encoding = mbfl_no2encoding(mbfl_no_encoding_utf8);
- break;
- case mbfl_no_language_japanese:
- encoding = mbfl_no2encoding(mbfl_no_encoding_euc_jp);
- break;
- case mbfl_no_language_korean:
- encoding = mbfl_no2encoding(mbfl_no_encoding_euc_kr);
- break;
- case mbfl_no_language_simplified_chinese:
- encoding = mbfl_no2encoding(mbfl_no_encoding_euc_cn);
- break;
- case mbfl_no_language_traditional_chinese:
- encoding = mbfl_no2encoding(mbfl_no_encoding_euc_tw);
- break;
- case mbfl_no_language_russian:
- encoding = mbfl_no2encoding(mbfl_no_encoding_koi8r);
- break;
- case mbfl_no_language_german:
- encoding = mbfl_no2encoding(mbfl_no_encoding_8859_15);
- break;
- case mbfl_no_language_armenian:
- encoding = mbfl_no2encoding(mbfl_no_encoding_armscii8);
- break;
- case mbfl_no_language_turkish:
- encoding = mbfl_no2encoding(mbfl_no_encoding_8859_9);
- break;
- default:
- encoding = mbfl_no2encoding(mbfl_no_encoding_8859_1);
- break;
- }
- }
+ /* falls back to UTF-8 if an unkown encoding name is given */
+ encoding = mbfl_no2encoding(mbfl_no_encoding_utf8);
+ }
MBSTRG(internal_encoding) = encoding;
MBSTRG(current_internal_encoding) = encoding;
#if HAVE_MBREGEX
{
const char *enc_name = new_value;
if (FAILURE == php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC)) {
- /* falls back to EUC-JP if an unknown encoding name is given */
- enc_name = "EUC-JP";
+ /* falls back to UTF-8 if an unknown encoding name is given */
+ enc_name = "UTF-8";
php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC);
}
php_mb_regex_set_mbctype(new_value TSRMLS_CC);
}
if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN
|| stage == PHP_INI_STAGE_RUNTIME) {
- return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
+ if (new_value_length) {
+ return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC);
+ } else {
+ return _php_mb_ini_mbstring_internal_encoding_set(PG(internal_encoding), strlen(PG(internal_encoding))+1 TSRMLS_CC);
+ }
} else {
/* the corresponding mbstring globals needs to be set according to the
* ini value in the later stage because it never falls back to the
PHP_INI_BEGIN()
PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_ALL, OnUpdate_mbstring_language)
PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order)
- PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_input)
- PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_output)
+ PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input)
+ PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output)
STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals)
PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character)
STD_PHP_INI_ENTRY("mbstring.func_overload", "0",
/* feed the string */
mbfl_string_init(&string);
- string.no_language = MBSTRG(language);
- string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
+ /* these are not needed. convd has encoding info.
+ string.no_language = MBSTRG(language);
+ string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding;
+ */
string.val = (unsigned char *)arg_string;
string.len = arg_string_len;
mbfl_buffer_converter_feed(MBSTRG(outconv), &string);
--- /dev/null
+--TEST--
+Encoding INI test
+--SKIPIF--
+<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
+--INI--
+default_charset=Shift_JIS
+internal_encoding=
+input_encoding=
+output_encoding=
+mbstring.internal_encoding=Shift_JIS
+mbstring.http_input=Shift_JIS
+mbstring.http_output=Shift_JIS
+--FILE--
+<?php
+echo "Getting INI\n";
+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(ini_get('mbstring.internal_encoding'));
+var_dump(mb_internal_encoding());
+var_dump(ini_get('mbstring.http_input'));
+var_dump(ini_get('mbstring.http_output'));
+
+echo "Setting INI\n";
+var_dump(ini_set('default_charset', 'UTF-8'));
+var_dump(ini_set('internal_encoding', 'UTF-8'));
+var_dump(ini_set('input_encoding', 'UTF-8'));
+var_dump(ini_set('output_encoding', 'UTF-8'));
+var_dump(ini_set('mbstring.internal_encoding', 'UTF-8'));
+var_dump(ini_set('mbstring.http_input', 'UTF-8'));
+var_dump(ini_set('mbstring.http_output', 'UTF-8'));
+
+echo "Getting INI\n";
+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(ini_get('mbstring.internal_encoding'));
+var_dump(mb_internal_encoding());
+var_dump(ini_get('mbstring.http_input'));
+var_dump(ini_get('mbstring.http_output'));
+
+
+--EXPECT--
+Getting INI
+string(9) "Shift_JIS"
+string(0) ""
+string(0) ""
+string(0) ""
+string(9) "Shift_JIS"
+string(4) "SJIS"
+string(9) "Shift_JIS"
+string(9) "Shift_JIS"
+Setting INI
+string(9) "Shift_JIS"
+string(0) ""
+string(0) ""
+string(0) ""
+string(9) "Shift_JIS"
+string(9) "Shift_JIS"
+string(9) "Shift_JIS"
+Getting INI
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
+string(5) "UTF-8"
*/
static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all)
{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len = 0;
+ char *str, *hint_charset = PHP_DEFAULT_CHARSET;
+ int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1;
size_t new_len;
long flags = ENT_COMPAT;
char *replaced;
Convert all HTML entities to their applicable characters */
PHP_FUNCTION(html_entity_decode)
{
- char *str, *hint_charset = NULL;
- int str_len, hint_charset_len = 0;
+ char *str, *hint_charset = PHP_DEFAULT_CHARSET;
+ int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1;
size_t new_len = 0;
long quote_style = ENT_COMPAT;
char *replaced;
#ifndef SAPI_H
#define SAPI_H
+#include "php.h"
#include "zend.h"
#include "zend_API.h"
#include "zend_llist.h"
#define SAPI_HEADER_SEND_FAILED 3
#define SAPI_DEFAULT_MIMETYPE "text/html"
-#define SAPI_DEFAULT_CHARSET ""
+#define SAPI_DEFAULT_CHARSET PHP_DEFAULT_CHARSET
#define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION
#define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D)
}
/* }}} */
+/* {{{ PHP_INI_MH
+ */
+static PHP_INI_MH(OnUpdateInternalEncoding)
+{
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_INI_MH
+ */
+static PHP_INI_MH(OnUpdateInputEncoding)
+{
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+ return SUCCESS;
+}
+/* }}} */
+
+/* {{{ PHP_INI_MH
+ */
+static PHP_INI_MH(OnUpdateOutputEncoding)
+{
+ if (new_value_length) {
+ OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ } else {
+ OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
+ }
+ return SUCCESS;
+}
+/* }}} */
+
/* {{{ PHP_INI_MH
*/
static PHP_INI_MH(OnUpdateErrorLog)
STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_append_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_prepend_file, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals)
- STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals)
- STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals)
+ STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals)
+ STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals)
+ STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals)
+ STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals)
STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals)
#define PHP_API_VERSION 20131106
#define PHP_HAVE_STREAMS
#define YYDEBUG 0
+#define PHP_DEFAULT_CHARSET "UTF-8"
#include "php_version.h"
#include "zend.h"
char *auto_prepend_file;
char *auto_append_file;
+ char *input_encoding;
+ char *internal_encoding;
+ char *output_encoding;
+
arg_separators arg_separator;
char *variables_order;
; http://php.net/default-mimetype
default_mimetype = "text/html"
-; PHP's default character set is set to empty.
+; PHP's default character set is set to UTF-8
; http://php.net/default-charset
-;default_charset = "UTF-8"
+default_charset = "UTF-8"
+
+; PHP internal character encoding is set to empty.
+; If empty, default_charset is used.
+; http://php.net/internal-encoding
+;internal_encoding =
+
+; PHP input character encoding is set to empty.
+; If empty, default_charset is used.
+; http://php.net/input-encoding
+;input_encoding =
+
+; PHP output character encoding is set to empty.
+; If empty, default_charset is used.
+; mbstring or iconv output handler is used.
+; See also output_buffer.
+; http://php.net/output-encoding
+;output_encoding =
; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature and it will be removed in a future version.
;filter.default_flags =
[iconv]
-;iconv.input_encoding = ISO-8859-1
-;iconv.internal_encoding = ISO-8859-1
-;iconv.output_encoding = ISO-8859-1
+; Use of this INI entory is deprecated, use global input_encoding instead.
+; If empty, input_encoding is used.
+;iconv.input_encoding =
+
+; Use of this INI entory is deprecated, use global internal_encoding instead.
+; If empty, internal_encoding is used.
+;iconv.internal_encoding =
+
+; Use of this INI entory is deprecated, use global output_encoding instead.
+; If empty, output_encoding is used.
+;iconv.output_encoding =
[intl]
;intl.default_locale =
[mbstring]
; language for internal character representation.
+; This affects mb_send_mail() and mbstrig.detect_order.
; http://php.net/mbstring.language
;mbstring.language = Japanese
+; Use of this INI entory is deprecated, use global internal_encoding instead.
; internal/script encoding.
-; Some encoding cannot work as internal encoding.
-; (e.g. SJIS, BIG5, ISO-2022-*)
+; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*)
+; If empty, default_charset or internal_encoding is used in order.
; http://php.net/mbstring.internal-encoding
-;mbstring.internal_encoding = UTF-8
+;mbstring.internal_encoding =
+; Use of this INI entory is deprecated, use global input_encoding instead.
; http input encoding.
+; If empty, input_encoding is used.
+; mbstring.encoding_traslation = On is needed to use this setting.
; http://php.net/mbstring.http-input
-;mbstring.http_input = UTF-8
+;mbstring.http_input =
-; http output encoding. mb_output_handler must be
-; registered as output buffer to function
+; Use of this INI entory is deprecated, use global output_encoding instead.
+; http output encoding.
+; mb_output_handler must be registered as output buffer to function.
+; If empty, output_encoding is used.
; http://php.net/mbstring.http-output
-;mbstring.http_output = pass
+;mbstring.http_output =
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
;mbstring.encoding_translation = Off
; automatic encoding detection order.
-; auto means
+; "auto" detect order is changed accoding to mbstring.language
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto
;mbstring.func_overload = 0
; enable strict encoding detection.
+; Default: Off
;mbstring.strict_detection = On
; This directive specifies the regex pattern of content types for which mb_output_handler()
; PHP's default character set is set to empty.
; http://php.net/default-charset
-;default_charset = "UTF-8"
+default_charset = "UTF-8"
+
+; PHP internal character encoding is set to empty.
+; If empty, default_charset is used.
+; http://php.net/internal-encoding
+;internal_encoding =
+
+; PHP input character encoding is set to empty.
+; http://php.net/input-encoding
+;input_encoding =
+
+; PHP output character encoding is set to empty.
+; mbstring or iconv output handler is used.
+; See also output_buffer.
+; http://php.net/output-encoding
+;output_encoding =
; Always populate the $HTTP_RAW_POST_DATA variable. PHP's default behavior is
; to disable this feature and it will be removed in a future version.
;filter.default_flags =
[iconv]
-;iconv.input_encoding = ISO-8859-1
-;iconv.internal_encoding = ISO-8859-1
-;iconv.output_encoding = ISO-8859-1
+; Use of this INI entory is deprecated, use global input_encoding instead.
+; If empty, input_encoding is used.
+;iconv.input_encoding =
+
+; Use of this INI entory is deprecated, use global internal_encoding instead.
+; If empty, internal_encoding is used.
+;iconv.internal_encoding =
+
+; Use of this INI entory is deprecated, use global output_encoding instead.
+; If empty, output_encoding is used.
+;iconv.output_encoding =
[intl]
;intl.default_locale =
[mbstring]
; language for internal character representation.
+; This affects mb_send_mail() and mbstrig.detect_order.
; http://php.net/mbstring.language
;mbstring.language = Japanese
+; Use of this INI entory is deprecated, use global internal_encoding instead.
; internal/script encoding.
-; Some encoding cannot work as internal encoding.
-; (e.g. SJIS, BIG5, ISO-2022-*)
+; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*)
+; If empty, default_charset or internal_encoding is used in order.
; http://php.net/mbstring.internal-encoding
-;mbstring.internal_encoding = UTF-8
+;mbstring.internal_encoding =
+; Use of this INI entory is deprecated, use global input_encoding instead.
; http input encoding.
+; If empty, input_encoding is used.
+; mbstring.encoding_traslation = On is needed to use this setting.
; http://php.net/mbstring.http-input
-;mbstring.http_input = UTF-8
+;mbstring.http_input =
-; http output encoding. mb_output_handler must be
-; registered as output buffer to function
+; Use of this INI entory is deprecated, use global output_encoding instead.
+; http output encoding.
+; mb_output_handler must be registered as output buffer to function.
+; If empty, output_encoding is used.
; http://php.net/mbstring.http-output
-;mbstring.http_output = pass
+;mbstring.http_output =
; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
;mbstring.encoding_translation = Off
; automatic encoding detection order.
-; auto means
+; "auto" detect order is changed accoding to mbstring.language
; http://php.net/mbstring.detect-order
;mbstring.detect_order = auto
;mbstring.func_overload = 0
; enable strict encoding detection.
+; Default: Off
;mbstring.strict_detection = On
; This directive specifies the regex pattern of content types for which mb_output_handler()
--EXPECTF--
Status: 403 Forbidden
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Status: 403 Forbidden
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
X-Powered-By: PHP/%s
Status: 403 Also Forbidden
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Done
<?php ?>
----------
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php header_remove(); ?>
----------
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php header_remove("X-Foo"); ?>
----------
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php
----------
X-Powered-By: PHP/%s
X-Foo: Bar
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php
----------
X-Powered-By: PHP/%s
X-Bar: Baz
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php
----------
X-Powered-By: PHP/%s
X-Foo: Bar
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Warning: Header to delete may not contain colon. in %s on line 3
----------
X-Powered-By: PHP/%s
X-Foo: Bar
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Warning: Header to delete may not contain colon. in %s on line 3
header_remove();
?>
----------
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php
?>
----------
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
----------
<?php
?>
----------
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Warning: Header to delete may not contain colon. in %s on line 2
----------
X-Powered-By: PHP/%s
X-Foo: Bar
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
flush
Host: localhost
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
OK
HTTP/1.0 500 Internal Server Error
Host: localhost
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
HTTP/1.0 500 Internal Server Error
Host: localhost
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
HTTP/1.0 500 Internal Server Error
Host: localhost
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
HTTP/1.1 200 OK
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
array(1) {
["foo"]=>
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(19) "HTTP_HOST:localhost"
string(21) "HTTP_USER_AGENT:dummy"
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
array(1) {
["userfile"]=>
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(3) "foo"
string(3) "bar"
Connection: close
X-Powered-By: PHP/%s
WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="acbd18db4cc2f85cedef654fccc4a4d8"
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(8) "HTTP/1.1"
HTTP/1.0 200 OK
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(8) "HTTP/1.0"
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(8) "/foo/bar"
HTTP/1.0 200 OK
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(9) "/foo/bar/"
HTTP/1.0 404 Not Found
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(18) "/index.php/foo/bar"
string(10) "/index.php"
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(19) "/index.php/foo/bar/"
string(10) "/index.php"
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
Array
(
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
<br />
<b>Fatal error</b>: Call to undefined function non_exists_function() in <b>%ssyntax_error.php</b> on line <b>%s</b><br />
Host: %s
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(%d) "%sindex.php"
Host: %s
Connection: close
X-Powered-By: %s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
string(5) "PATCH"
Connection: close
X-Powered-By: %s
Bar-Foo: Foo
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
array(2) {
["Host"]=>
["Bar-Foo"]=>
string(3) "Foo"
["Content-type"]=>
- string(9) "text/html"
+ string(24) "text/html; charset=UTF-8"
}
}
$prev = "----123
-Content-Type: text/plain
+Content-Type: text/plain; charset=UTF-8
Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n";
$post = "\n----123--\n";
$total = $length + strlen($prev) + strlen($post);
Host: %s
Connection: close
X-Powered-By: PHP/%s
-Content-type: text/html
+Content-type: text/html; charset=UTF-8
array(1) {
["file1"]=>
--- /dev/null
+--TEST--
+PHP encoding setting test
+--INI--
+--FILE--
+<?php
+var_dump(ini_get('default_charset'));
+var_dump(ini_get('input_encoding'));
+var_dump(ini_get('internal_encoding'));
+var_dump(ini_get('output_encoding'));
+
+var_dump(ini_set('default_charset', 'ISO-8859-1'));
+var_dump(ini_get('default_charset'));
+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_get('input_encoding'));
+var_dump(ini_get('internal_encoding'));
+var_dump(ini_get('output_encoding'));
+
+--EXPECTF--
+string(5) "UTF-8"
+string(0) ""
+string(0) ""
+string(0) ""
+string(5) "UTF-8"
+string(10) "ISO-8859-1"
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(0) ""
+string(10) "ISO-8859-1"
+string(10) "ISO-8859-1"
+string(10) "ISO-8859-1"
\ No newline at end of file