xref: /PHP-7.2/ext/iconv/tests/bug48147.phpt (revision 473ec539)
1--TEST--
2Bug #48147 (iconv with //IGNORE cuts the string)
3--SKIPIF--
4<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
5--FILE--
6<?php
7$text = "aa\xC3\xC3\xC3\xB8aa";
8var_dump(iconv("UTF-8", "UTF-8", $text));
9var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", $text)));
10// only invalid
11var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3")));
12// start invalid
13var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "\xC3\xC3\xC3\xB8aa")));
14// finish invalid
15var_dump(urlencode(iconv("UTF-8", "UTF-8//IGNORE", "aa\xC3\xC3\xC3")));
16?>
17--EXPECTF--
18Notice: iconv(): Detected an illegal character in input string in %s on line %d
19bool(false)
20string(10) "aa%C3%B8aa"
21
22Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
23string(0) ""
24string(8) "%C3%B8aa"
25
26Notice: iconv(): Detected an incomplete multibyte character in input string in %s on line %d
27string(0) ""
28