xref: /PHP-8.0/ext/iconv/tests/bug76249.phpt (revision f8d79582)
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}
13var_dump(stream_get_contents($fh));
14?>
15DONE
16--EXPECTF--
17Warning: stream_get_contents(): iconv stream filter ("ucs-2"=>"utf%A8//IGNORE"): invalid multibyte sequence in %sbug76249.php on line %d
18string(0) ""
19DONE
20