File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #80384 large reads cause filters to internally buffer large amounts of memory
3
+ --FILE--
4
+ <?php
5
+ /* First, create a file to read */
6
+ $ tmp_filename = __DIR__ . "/bug80384.tmp " ;
7
+ $ fp = fopen ($ tmp_filename , 'w ' );
8
+ for ($ i =0 ; $ i <1024 ; $ i ++) {
9
+ fwrite ($ fp , str_repeat ('ABCDEFGH ' , 1024 ));
10
+ }
11
+ fclose ($ fp );
12
+
13
+ /* Stream the file through a filter */
14
+ $ fp = fopen ($ tmp_filename , 'r ' );
15
+ $ filter = stream_filter_append ($ fp , "string.rot13 " );
16
+
17
+ $ mem_start = memory_get_usage ();
18
+ fread ($ fp , 8 * 1024 * 1024 );
19
+ $ mem_final = memory_get_usage ();
20
+ fclose ($ fp );
21
+ var_dump ($ mem_final - $ mem_start < 32768 );
22
+ ?>
23
+ --CLEAN--
24
+ <?php
25
+ unlink (__DIR__ . "/bug80384.tmp " );
26
+ ?>
27
+ --EXPECT--
28
+ bool(true)
You can’t perform that action at this time.
0 commit comments