History log of /PHP-8.1/ext/standard/tests/streams/bug81659.phpt (Results 1 – 1 of 1)
Revision Date Author Comments
# 31749aac 26-Nov-2021 Christoph M. Becker

Fix #81659: stream_get_contents() may unnecessarily overallocate

Since we're going to read from the current stream position anyway, the
`max_len` should be the size of the file minus the

Fix #81659: stream_get_contents() may unnecessarily overallocate

Since we're going to read from the current stream position anyway, the
`max_len` should be the size of the file minus the current position
(still catering to potentially filtered streams). We must, however,
make sure to cater to the file position being beyond the actual file
size.

While we're at, we also fix the step size in the comment, which is 8K.

A further optimization could be done for unfiltered streams, thus
saving that step size, but 8K might not be worth it.

Closes GH-7693.

show more ...