mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
fix tests.
This commit is contained in:
parent
2725e485ba
commit
317bedda3f
@ -21,35 +21,35 @@ $ascii = 'abcdefghijklmnopqrstuvwxyz;]=#0123456789';
|
||||
|
||||
// ASCII
|
||||
echo "== ASCII ==\n";
|
||||
print strlen($ascii,'ASCII') . "\n";
|
||||
print mb_strlen($ascii,'ASCII') . "\n";
|
||||
print strlen($ascii) . "\n";
|
||||
|
||||
// EUC-JP
|
||||
echo "== EUC-JP ==\n";
|
||||
print strlen($euc_jp,'EUC-JP') . "\n";
|
||||
print mb_strlen($euc_jp,'EUC-JP') . "\n";
|
||||
mb_internal_encoding('EUC-JP') or print("mb_internal_encoding() failed\n");
|
||||
print strlen($euc_jp) . "\n";
|
||||
|
||||
// SJIS
|
||||
echo "== SJIS ==\n";
|
||||
$sjis = mb_convert_encoding($euc_jp, 'SJIS');
|
||||
print strlen($sjis,'SJIS') . "\n";
|
||||
$sjis = mb_convert_encoding($euc_jp, 'SJIS','EUC-JP');
|
||||
print mb_strlen($sjis,'SJIS') . "\n";
|
||||
mb_internal_encoding('SJIS') or print("mb_internal_encoding() failed\n");
|
||||
print strlen($sjis) . "\n";
|
||||
|
||||
// JIS
|
||||
// Note: either convert_encoding or strlen has problem
|
||||
echo "== JIS ==\n";
|
||||
$jis = mb_convert_encoding($euc_jp, 'JIS');
|
||||
print strlen($jis,'JIS') . "\n";
|
||||
$jis = mb_convert_encoding($euc_jp, 'JIS','EUC-JP');
|
||||
print mb_strlen($jis,'JIS') . "\n";
|
||||
mb_internal_encoding('JIS') or print("mb_internal_encoding() failed\n");
|
||||
print strlen($jis) . "\n";
|
||||
|
||||
// UTF-8
|
||||
// Note: either convert_encoding or strlen has problem
|
||||
echo "== UTF-8 ==\n";
|
||||
$utf8 = mb_convert_encoding($euc_jp, 'UTF-8');
|
||||
print strlen($utf8,'UTF-8') . "\n";
|
||||
$utf8 = mb_convert_encoding($euc_jp, 'UTF-8','EUC-JP');
|
||||
print mb_strlen($utf8,'UTF-8') . "\n";
|
||||
mb_internal_encoding('UTF-8') or print("mb_internal_encoding() failed\n");
|
||||
print strlen($utf8) . "\n";
|
||||
|
||||
@ -60,40 +60,36 @@ echo "== WRONG PARAMETERS ==\n";
|
||||
// Note: PHP Notice, but returns some value
|
||||
$r = strlen($t_ary);
|
||||
echo $r."\n";
|
||||
|
||||
// Object
|
||||
// Note: PHP Catchable error
|
||||
// Note: PHP Notice, but returns some value
|
||||
$r = strlen($t_obj);
|
||||
echo $r."\n";
|
||||
|
||||
// Wrong encoding
|
||||
mb_internal_encoding('EUC-JP');
|
||||
$r = strlen($euc_jp, 'BAD_NAME');
|
||||
$r = mb_strlen($euc_jp, 'BAD_NAME');
|
||||
echo $r."\n";
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
--EXPECT--
|
||||
== ASCII ==
|
||||
ERR: Warning
|
||||
|
||||
40
|
||||
40
|
||||
== EUC-JP ==
|
||||
ERR: Warning
|
||||
|
||||
43
|
||||
72
|
||||
== SJIS ==
|
||||
ERR: Warning
|
||||
|
||||
43
|
||||
72
|
||||
== JIS ==
|
||||
ERR: Warning
|
||||
|
||||
121
|
||||
43
|
||||
90
|
||||
== UTF-8 ==
|
||||
ERR: Warning
|
||||
|
||||
174
|
||||
43
|
||||
101
|
||||
== WRONG PARAMETERS ==
|
||||
ERR: Notice
|
||||
5
|
||||
@ -101,3 +97,6 @@ ERR: Catchable fatal error
|
||||
ERR: Notice
|
||||
6
|
||||
ERR: Warning
|
||||
|
||||
|
||||
|
||||
|
@ -4,6 +4,7 @@ mb_substr()
|
||||
<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?>
|
||||
--INI--
|
||||
output_handler=
|
||||
mbstring.func_overload=0
|
||||
--FILE--
|
||||
<?php
|
||||
// TODO: Add more encodings
|
||||
|
Loading…
Reference in New Issue
Block a user