mirror of
https://github.com/php/php-src.git
synced 2026-04-28 18:53:33 +02:00
dc7aa22b18
Similar to what fread() does, truncate the stream_get_contents() result if the original buffer was way too large.
19 lines
295 B
PHP
19 lines
295 B
PHP
--TEST--
|
|
memory allocation on stream_get_contents()
|
|
--INI--
|
|
memory_limit=32M
|
|
--FILE--
|
|
<?php
|
|
$f = tmpfile();
|
|
fwrite($f, '.');
|
|
|
|
$chunks = array();
|
|
for ($i = 0; $i < 1000; ++$i) {
|
|
rewind($f);
|
|
$chunks[] = stream_get_contents($f, 1000000);
|
|
}
|
|
var_dump(count($chunks));
|
|
?>
|
|
--EXPECT--
|
|
int(1000)
|