xref: /PHP-7.1/ext/iconv/tests/bug76249.phpt (revision 4371af3e)
1--TEST--
2Bug #76249 (stream filter convert.iconv leads to infinite loop on invalid sequence)
3--SKIPIF--
4<?php extension_loaded('iconv') or die('skip iconv extension is not available'); ?>
5--FILE--
6<?php
7$fh = fopen('php://memory', 'rw');
8fwrite($fh, "abc");
9rewind($fh);
10if (false === @stream_filter_append($fh, 'convert.iconv.ucs-2/utf8//IGNORE', STREAM_FILTER_READ, [])) {
11	stream_filter_append($fh, 'convert.iconv.ucs-2/utf-8//IGNORE', STREAM_FILTER_READ, []);
12}
13$a = stream_get_contents($fh);
14var_dump(strlen($a));
15?>
16DONE
17--EXPECTF--
18Warning: stream_get_contents(): iconv stream filter ("ucs-2"=>"utf%A8//IGNORE"): invalid multibyte sequence in %sbug76249.php on line %d
19int(3)
20DONE
21