xref: /PHP-8.1/ext/iconv/tests/bug76249.phpt (revision e9f783fc)
1--TEST--
2Bug #76249 (stream filter convert.iconv leads to infinite loop on invalid sequence)
3--EXTENSIONS--
4iconv
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