Skip to content

Commit 99c9cc2

Browse files
committed
Add test for bug #80384
1 parent 252bc44 commit 99c9cc2

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/basic/bug80384.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #80384 large reads cause filters to internally buffer large amounts of memory
3+
4+
--FILE--
5+
<?php
6+
/* First, create a file to read */
7+
$tmp_filename = __DIR__ . "/bug80384.tmp";
8+
$fp = fopen($tmp_filename, 'w');
9+
for ($i=0; $i<1024; $i++) {
10+
fwrite($fp, str_repeat('ABCDEFGH', 1024));
11+
}
12+
fclose($fp);
13+
14+
/* Stream the file through a filter */
15+
$fp = fopen($tmp_filename, 'r');
16+
$filter = stream_filter_append($fp, "string.rot13");
17+
fread($fp, 8 * 1024 * 1024);
18+
19+
echo (memory_get_usage() < 1024 * 1024);
20+
21+
fclose($fp);
22+
?>
23+
--CLEAN--
24+
$tmp_filename = __DIR__ . "/bug80384.tmp";
25+
--EXPECT--
26+
1

0 commit comments

Comments
 (0)