1--TEST--
2Bug #78902: Memory leak when using stream_filter_append
3--INI--
4memory_limit=512k
5--FILE--
6<?php
7
8/** create temporary file 2mb file */
9$tmp_file_name = tempnam(sys_get_temp_dir(), 'test_');
10$fp = fopen($tmp_file_name, 'w+');
11$size = 1024 * 1024 * 2; // 2mb
12$chunk = 1024;
13while ($size > 0) {
14    fputs($fp, str_pad('', min($chunk,$size)));
15    $size -= $chunk;
16}
17fclose($fp);
18
19$fp = fopen($tmp_file_name, 'r');
20stream_filter_append($fp, "string.toupper");
21while (!feof($fp)) {
22    fread($fp, 1);
23}
24fclose($fp);
25var_dump(true);
26?>
27--EXPECT--
28bool(true)
29