1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 03:03:26 +02:00
Files
archived-php-src/ext/standard/tests/streams/bug78902.phpt
T
2020-01-23 14:57:16 +01:00

29 lines
562 B
PHP

--TEST--
Bug #78902: Memory leak when using stream_filter_append
--INI--
memory_limit=512k
--FILE--
<?php
/** create temporary file 2mb file */
$tmp_file_name = tempnam(sys_get_temp_dir(), 'test_');
$fp = fopen($tmp_file_name, 'w+');
$size = 1024 * 1024 * 2; // 2mb
$chunk = 1024;
while ($size > 0) {
fputs($fp, str_pad('', min($chunk,$size)));
$size -= $chunk;
}
fclose($fp);
$fp = fopen($tmp_file_name, 'r');
stream_filter_append($fp, "string.toupper");
while (!feof($fp)) {
fread($fp, 1);
}
fclose($fp);
var_dump(true);
?>
--EXPECT--
bool(true)