php-src/ext/mbstring/tests/mb_http_input_multi_post.phpt
Alex Dowad 6df7557e43 mb_parse_str, mb_http_input, and mb_convert_variables use fast text conversion code for automatic encoding detection
For mb_parse_str, when mbstring.http_input (INI parameter) is a list of
multiple possible text encodings (which is not the case by default),
this new implementation is about 25% faster.

When mbstring.http_input is a single value, then nothing is changed.
(No automatic encoding detection is done in that case.)
2023-04-12 19:57:52 +02:00

43 lines
751 B
PHP

--TEST--
mb_http_input() with POST method and multiple candidate encodings
--EXTENSIONS--
mbstring
--POST--
a=日本語&b=ελληνικά
--INI--
mbstring.encoding_translation=1
input_encoding=UTF-8,SJIS,EUC-JP,ISO-8859-1
--FILE--
<?php
echo $_POST['a']."\n";
echo $_POST['b']."\n";
// Get encoding
var_dump(mb_http_input('P'));
var_dump(mb_http_input('G'));
var_dump(mb_http_input('C'));
var_dump(mb_http_input('S'));
var_dump(mb_http_input('I'));
var_dump(mb_http_input('L'));
?>
--EXPECT--
日本語
ελληνικά
string(5) "UTF-8"
bool(false)
bool(false)
bool(false)
array(4) {
[0]=>
string(5) "UTF-8"
[1]=>
string(4) "SJIS"
[2]=>
string(6) "EUC-JP"
[3]=>
string(10) "ISO-8859-1"
}
string(28) "UTF-8,SJIS,EUC-JP,ISO-8859-1"