mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-5.6'
* PHP-5.6: Implement RFC https://wiki.php.net/rfc/default_encoding
This commit is contained in:
commit
9a5cb51ebc
34 changed files with 464 additions and 161 deletions
|
@ -220,21 +220,55 @@ static char _generic_superset_name[] = ICONV_UCS4_ENCODING;
|
|||
#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()
|
||||
/* }}} */
|
||||
|
||||
|
|
|
@ -79,15 +79,9 @@ ZEND_END_MODULE_GLOBALS(iconv)
|
|||
#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
|
||||
|
|
68
ext/iconv/tests/iconv_ini_encoding.phpt
Normal file
68
ext/iconv/tests/iconv_ini_encoding.phpt
Normal file
|
@ -0,0 +1,68 @@
|
|||
--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"
|
|
@ -183,17 +183,17 @@ string(3) "0.5"
|
|||
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)
|
||||
|
@ -207,9 +207,9 @@ string(1) "1"
|
|||
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)
|
||||
|
@ -223,25 +223,25 @@ string(1) "1"
|
|||
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)
|
||||
|
@ -279,17 +279,17 @@ 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 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 --
|
||||
|
||||
|
@ -301,7 +301,7 @@ NULL
|
|||
|
||||
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
|
|
@ -1236,6 +1236,11 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input)
|
|||
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;
|
||||
|
@ -1261,18 +1266,20 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output)
|
|||
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(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;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -1285,47 +1292,17 @@ int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint new_v
|
|||
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);
|
||||
|
@ -1343,7 +1320,11 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding)
|
|||
}
|
||||
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
|
||||
|
@ -1450,8 +1431,8 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes)
|
|||
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",
|
||||
|
@ -2162,8 +2143,10 @@ PHP_FUNCTION(mb_output_handler)
|
|||
|
||||
/* 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);
|
||||
|
|
73
ext/mbstring/tests/ini_encoding.phpt
Normal file
73
ext/mbstring/tests/ini_encoding.phpt
Normal file
|
@ -0,0 +1,73 @@
|
|||
--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"
|
|
@ -1432,8 +1432,8 @@ encode_amp:
|
|||
*/
|
||||
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;
|
||||
|
@ -1504,8 +1504,8 @@ PHP_FUNCTION(htmlspecialchars_decode)
|
|||
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;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#ifndef SAPI_H
|
||||
#define SAPI_H
|
||||
|
||||
#include "php.h"
|
||||
#include "zend.h"
|
||||
#include "zend_API.h"
|
||||
#include "zend_llist.h"
|
||||
|
@ -291,7 +292,7 @@ struct _sapi_post_entry {
|
|||
#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)
|
||||
|
|
46
main/main.c
46
main/main.c
|
@ -415,6 +415,45 @@ static PHP_INI_DISP(display_errors_mode)
|
|||
}
|
||||
/* }}} */
|
||||
|
||||
/* {{{ 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)
|
||||
|
@ -522,8 +561,11 @@ PHP_INI_BEGIN()
|
|||
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)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define PHP_API_VERSION 20131218
|
||||
#define PHP_HAVE_STREAMS
|
||||
#define YYDEBUG 0
|
||||
#define PHP_DEFAULT_CHARSET "UTF-8"
|
||||
|
||||
#include "php_version.h"
|
||||
#include "zend.h"
|
||||
|
|
|
@ -96,6 +96,10 @@ struct _php_core_globals {
|
|||
char *auto_prepend_file;
|
||||
char *auto_append_file;
|
||||
|
||||
char *input_encoding;
|
||||
char *internal_encoding;
|
||||
char *output_encoding;
|
||||
|
||||
arg_separators arg_separator;
|
||||
|
||||
char *variables_order;
|
||||
|
|
|
@ -678,9 +678,26 @@ auto_append_file =
|
|||
; 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 =
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Paths and Directories ;
|
||||
|
@ -925,9 +942,17 @@ cli_server.color = On
|
|||
;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 =
|
||||
|
@ -1690,23 +1715,30 @@ mssql.secure_connection = Off
|
|||
|
||||
[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
|
||||
|
@ -1717,7 +1749,7 @@ mssql.secure_connection = Off
|
|||
;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
|
||||
|
||||
|
@ -1738,6 +1770,7 @@ mssql.secure_connection = Off
|
|||
;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()
|
||||
|
|
|
@ -680,7 +680,22 @@ default_mimetype = "text/html"
|
|||
|
||||
; 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 =
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; Paths and Directories ;
|
||||
|
@ -925,9 +940,17 @@ cli_server.color = On
|
|||
;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 =
|
||||
|
@ -1690,23 +1713,30 @@ mssql.secure_connection = Off
|
|||
|
||||
[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
|
||||
|
@ -1717,7 +1747,7 @@ mssql.secure_connection = Off
|
|||
;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
|
||||
|
||||
|
@ -1738,6 +1768,7 @@ mssql.secure_connection = Off
|
|||
;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()
|
||||
|
|
|
@ -40,14 +40,14 @@ echo "Done\n";
|
|||
--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
|
||||
|
|
|
@ -65,18 +65,18 @@ header_remove("X-Foo");
|
|||
<?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
|
||||
|
@ -85,7 +85,7 @@ header("X-Foo: Bar");
|
|||
----------
|
||||
X-Powered-By: PHP/%s
|
||||
X-Foo: Bar
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
----------
|
||||
<?php
|
||||
|
@ -96,7 +96,7 @@ header_remove("X-Foo");
|
|||
----------
|
||||
X-Powered-By: PHP/%s
|
||||
X-Bar: Baz
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
----------
|
||||
<?php
|
||||
|
@ -106,7 +106,7 @@ header_remove("X-Foo: Bar");
|
|||
----------
|
||||
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
|
||||
|
@ -118,7 +118,7 @@ header_remove("X-Foo:");
|
|||
----------
|
||||
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
|
||||
|
@ -128,7 +128,7 @@ header("X-Foo: Bar");
|
|||
header_remove();
|
||||
?>
|
||||
----------
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
----------
|
||||
<?php
|
||||
|
@ -136,7 +136,7 @@ header_remove("");
|
|||
?>
|
||||
----------
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
----------
|
||||
<?php
|
||||
|
@ -144,7 +144,7 @@ header_remove(":");
|
|||
?>
|
||||
----------
|
||||
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
|
||||
|
@ -158,7 +158,7 @@ header_remove("X-Foo");
|
|||
----------
|
||||
X-Powered-By: PHP/%s
|
||||
X-Foo: Bar
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
flush
|
||||
|
||||
|
|
|
@ -60,23 +60,23 @@ HTTP/1.1 200 OK
|
|||
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
|
||||
|
|
|
@ -36,4 +36,4 @@ HTTP/1.1 100 Continue
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
|
|
@ -36,4 +36,4 @@ HTTP/1.1 422 Unknown Status Code
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
|
|
@ -36,4 +36,4 @@ HTTP/1.1 511 Network Authentication Required
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
|
|
@ -39,7 +39,7 @@ fclose($fp);
|
|||
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"]=>
|
||||
|
|
|
@ -40,7 +40,7 @@ HTTP/1.1 200 OK
|
|||
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"
|
||||
|
|
|
@ -52,7 +52,7 @@ HTTP/1.1 200 OK
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
array(1) {
|
||||
["userfile"]=>
|
||||
|
|
|
@ -36,7 +36,7 @@ HTTP/1.1 200 OK
|
|||
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"
|
||||
|
|
|
@ -37,4 +37,4 @@ Host: %s
|
|||
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
|
||||
|
|
|
@ -56,13 +56,13 @@ HTTP/1.1 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.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"
|
||||
|
|
|
@ -80,14 +80,14 @@ HTTP/1.1 200 OK
|
|||
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
|
||||
|
|
|
@ -57,7 +57,7 @@ HTTP/1.1 200 OK
|
|||
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"
|
||||
|
@ -67,7 +67,7 @@ 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(19) "/index.php/foo/bar/"
|
||||
string(10) "/index.php"
|
||||
|
|
|
@ -42,7 +42,7 @@ HTTP/1.1 200 OK
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
Array
|
||||
(
|
||||
|
|
|
@ -43,7 +43,7 @@ HTTP/1.1 200 OK
|
|||
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 />
|
||||
|
|
|
@ -39,6 +39,6 @@ HTTP/1.1 200 OK
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: %s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
string(%d) "%sindex.php"
|
||||
|
|
|
@ -39,6 +39,6 @@ HTTP/1.1 200 OK
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: %s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
string(5) "PATCH"
|
||||
|
|
|
@ -44,7 +44,7 @@ Host: %s
|
|||
Connection: close
|
||||
X-Powered-By: %s
|
||||
Bar-Foo: Foo
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
array(2) {
|
||||
["Host"]=>
|
||||
|
@ -64,5 +64,5 @@ array(3) {
|
|||
["Bar-Foo"]=>
|
||||
string(3) "Foo"
|
||||
["Content-type"]=>
|
||||
string(9) "text/html"
|
||||
string(24) "text/html; charset=UTF-8"
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ if (!$fp) {
|
|||
}
|
||||
|
||||
$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);
|
||||
|
@ -79,7 +79,7 @@ HTTP/1.1 200 OK
|
|||
Host: %s
|
||||
Connection: close
|
||||
X-Powered-By: PHP/%s
|
||||
Content-type: text/html
|
||||
Content-type: text/html; charset=UTF-8
|
||||
|
||||
array(1) {
|
||||
["file1"]=>
|
||||
|
|
39
tests/basic/encoding.phpt
Normal file
39
tests/basic/encoding.phpt
Normal file
|
@ -0,0 +1,39 @@
|
|||
--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"
|
Loading…
Add table
Add a link
Reference in a new issue