Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
--TEST-- Bug #78902: Memory leak when using stream_filter_append --INI-- memory_limit=2M -..
Decoded Output download
--TEST--
Bug #78902: Memory leak when using stream_filter_append
--INI--
memory_limit=2M
--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, larger than the memory limit
$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)
Did this file decode correctly?
Original Code
--TEST--
Bug #78902: Memory leak when using stream_filter_append
--INI--
memory_limit=2M
--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, larger than the memory limit
$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)
Function Calls
sys_get_temp_dir | 1 |
Stats
MD5 | 2ec39a48fc983c8319751d34b3d776ee |
Eval Count | 0 |
Decode Time | 86 ms |