History log of /PHP-8.0/main/streams/streams.c (Results 1 – 25 of 335)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# d0b3096f 12-Sep-2022 Dmitry Stogov

Reset FG(user_stream_current_filename) at the end of request

Attempt to fix oss-fuzz #51047


# 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 ...


# 4a1af1f8 10-Aug-2021 Christoph M. Becker

Fix #81346: Non-seekable streams don't update position after write

The stream position is not related to the buffer, and needs to be
updated for non-seekable streams as well. The errone

Fix #81346: Non-seekable streams don't update position after write

The stream position is not related to the buffer, and needs to be
updated for non-seekable streams as well. The erroneous condition
around the position update is a relict of an old commit[1].

The unexpected test expectation is due to bug #81345.

[1] <https://github.com/php/php-src/commit/088e2692c3d1e680fd3d9306c4adb417e761acff>

Closes GH-7356.

show more ...


# b95b5534 25-Mar-2021 Nikita Popov

Remove zero size special case for copy_to_stream

This doesn't seem to serve a purpose anymore. Stats are expensive,
so doing an unnecessary stat just to short-circuit the zero size
c

Remove zero size special case for copy_to_stream

This doesn't seem to serve a purpose anymore. Stats are expensive,
so doing an unnecessary stat just to short-circuit the zero size
case is rather dubious. It can also break with stream wrappers
that return inaccurate sizes (symfony/symfony#40574) and probably
can also break with stream filters.

Drop the special case and adjust code to make it more obvious that
it will still be handled correctly.

Closes GH-6807.

show more ...


# 963e50c8 16-Feb-2021 Christoph M. Becker

Fix #75776: Flushing streams with compression filter is broken

First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Fix #75776: Flushing streams with compression filter is broken

First, the `bzip2.compress` filter has the same issue as `zlib.deflate`
so we port the respective fix[1] to ext/bz2.

Second, there is still an issue, if a stream with an attached
compression filter is flushed before it is closed, without any writes
in between. In that case, the compression is never finalized. We fix
this by enforcing a `_php_stream_flush()` with the `closing` flag set
in `_php_stream_free()`, whenever a write filter is attached. This
call is superfluous for most write filters, but does not hurt, even
when it is unnecessary.

[1] <http://git.php.net/?p=php-src.git;a=commit;h=20e75329f2adb11dd231852c061926d0e4080929>

Closes GH-6703.

show more ...


# 70dfbe00 01-Dec-2020 Adam Seitz

Fix #80384: limit read buffer size

In the case of a stream with no filters, php_stream_fill_read_buffer
only reads stream->chunk_size into the read buffer. If the stream has
filters

Fix #80384: limit read buffer size

In the case of a stream with no filters, php_stream_fill_read_buffer
only reads stream->chunk_size into the read buffer. If the stream has
filters attached, it could unnecessarily buffer a large amount of data.

With this change, php_stream_fill_read_buffer only proceeds until either
the requested size or stream->chunk_size is available in the read buffer.

Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-6444.

show more ...


Revision tags: php-8.0.0, php-7.3.25, php-7.4.13, php-8.0.0RC5, php-7.4.13RC1, php-8.0.0RC4, php-7.3.25RC1, php-7.4.12, php-8.0.0RC3, php-7.3.24, php-8.0.0RC2, php-7.4.12RC1, php-7.3.24RC1, php-7.2.34, php-8.0.0rc1, php-7.4.11, php-7.3.23
# 65f5573b 22-Sep-2020 Christoph M. Becker

Fix #77069: stream filter loses final block of data

Reading from a stream may return greater than zero, but nonetheless the
stream's EOF flag may have been set. We have to cater to this

Fix #77069: stream filter loses final block of data

Reading from a stream may return greater than zero, but nonetheless the
stream's EOF flag may have been set. We have to cater to this
condition by setting the close flag for filters.

We also have to cater to that change in the zlib.inflate filter:

If `inflate()` is called with flush mode `Z_FINISH`, but the output
buffer is not large enough to inflate all available data, it fails with
`Z_BUF_ERROR`. However, `Z_BUF_ERROR` is not fatal; in fact, the zlib
manual states: "If deflate returns with Z_OK or Z_BUF_ERROR, this
function must be called again with Z_FINISH and more output space
(updated avail_out) but no more input data, until it returns with
Z_STREAM_END or an error." Hence, we do so.

Closes GH-6001.

show more ...


# ffa57164 23-Sep-2020 Christoph M. Becker

Clear error flag instead of toggling it

The toggling of the `REPORT_ERRORS` looks fishy, and likely was
intented as clearing.

Closes GH-6190.


# 19c84459 21-Sep-2020 Christoph M. Becker

Fix mmap copying

Instead of attempting to map large files into memory at once, we map
chunks of at most `PHP_STREAM_MMAP_MAX` bytes, and repeat that until we
hit the point where `php

Fix mmap copying

Instead of attempting to map large files into memory at once, we map
chunks of at most `PHP_STREAM_MMAP_MAX` bytes, and repeat that until we
hit the point where `php_stream_seek()` fails (see bug 54902), and copy
the rest of the file by reading and writing small chunks.

We also fix the mapping behavior for zero bytes on Windows, which did
not error (as with `mmap()`), but would have mapped the remaining file.

show more ...


Revision tags: php-8.0.0beta4, php-7.4.11RC1, php-7.3.23RC1, php-8.0.0beta3, php-7.4.10, php-7.3.22, php-8.0.0beta2, php-7.3.22RC1, php-7.4.10RC1, php-8.0.0beta1, php-7.4.9, php-7.2.33, php-7.3.21
# c3105a1f 28-Jul-2020 George Peter Banyard

ValueError for empty path in stream code

Closes GH-5902


Revision tags: php-8.0.0alpha3, php-7.4.9RC1, php-7.3.21RC1, php-7.4.8, php-7.2.32, php-8.0.0alpha2, php-7.3.20
# 2b5de6f8 01-Jul-2020 Max Semenik

Remove proto comments from C files

Closes GH-5758


Revision tags: php-8.0.0alpha1, php-7.4.8RC1, php-7.3.20RC1, php-7.4.7, php-7.3.19
# 7d6a0ba8 07-Jun-2020 twosee

Fix expression warnings and break warnings

Close GH-5675.


Revision tags: php-7.4.7RC1, php-7.3.19RC1, php-7.4.6, php-7.2.31, php-7.4.6RC1, php-7.3.18RC1, php-7.2.30, php-7.4.5, php-7.3.17
# 13842eda 13-Apr-2020 dinosaur

Fixed bug #79468

Close the stream filter resources when removing them from the stream.


# 95eaccd0 13-Apr-2020 dinosaur

Fixed bug #79468

Close the stream filter resources when removing them from the stream.


Revision tags: php-7.4.5RC1, php-7.3.17RC1, php-7.3.18, php-7.4.4, php-7.2.29, php-7.3.16, php-7.4.4RC1, php-7.3.16RC1, php-7.4.3, php-7.2.28, php-7.3.15RC1, php-7.4.3RC1, php-7.3.15, php-7.2.27, php-7.4.2, php-7.3.14, php-7.3.14RC1, php-7.4.2RC1, php-7.4.1, php-7.2.26, php-7.3.13
# 67421a78 16-Dec-2019 liudaixiao

Fixed bug #78902


# d1764ca3 15-Jan-2020 Máté Kocsis

Make error messages more consistent by fixing capitalization

Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.


# f77747b0 30-Dec-2019 Nikita Popov

Properly propagate url_stat exceptions during include

Make sure we abort operations early, and that we don't emit
additional warnings or errors if an exception has been thrown.


Revision tags: php-7.4.1RC1, php-7.3.13RC1, php-7.2.26RC1, php-7.4.0, php-7.2.25, php-7.3.12, php-7.4.0RC6, php-7.3.12RC1, php-7.2.25RC1, php-7.4.0RC5, php-7.1.33, php-7.2.24, php-7.3.11, php-7.4.0RC4, php-7.3.11RC1, php-7.2.24RC1, php-7.4.0RC3, php-7.2.23, php-7.3.10, php-7.4.0RC2, php-7.2.23RC1, php-7.3.10RC1, php-7.4.0RC1, php-7.1.32, php-7.2.22, php-7.3.9, php-7.4.0beta4, php-7.2.22RC1, php-7.3.9RC1, php-7.4.0beta2, php-7.1.31, php-7.2.21, php-7.3.8, php-7.4.0beta1
# 5cbe5a53 18-Jul-2019 Nikita Popov

Don't use chunking for stream writes

We're currently splitting up large writes into 8K size chunks, which
adversely affects I/O performance in some cases. Splitting up writes
doesn't

Don't use chunking for stream writes

We're currently splitting up large writes into 8K size chunks, which
adversely affects I/O performance in some cases. Splitting up writes
doesn't make a lot of sense, as we already must have a backing buffer,
so there is no memory/performance tradeoff to be made here.

This change disables the write chunking at the stream layer, but
retains the current retry loop for partial writes. In particular
network writes will typically only write part of the data for large
writes, so we need to keep the retry loop to preserve backwards
compatibility.

If issues due to this change turn up, chunking should be reintroduced
at lower levels where it is needed to avoid issues for specific streams,
rather than unnecessarily enforcing it for all streams.

show more ...


# 2fdd142f 08-Oct-2019 Nikita Popov

Check for exception after applying stream filters

This makes the stream opening actually fail, and avoids assertion
failures when we tokenize with EG(exception) set.

Also avoid

Check for exception after applying stream filters

This makes the stream opening actually fail, and avoids assertion
failures when we tokenize with EG(exception) set.

Also avoid throwing an additional warning after an exception has
already been thrown.

show more ...


Revision tags: php-7.2.21RC1, php-7.3.8RC1, php-7.4.0alpha3, php-7.3.7, php-7.2.20, php-7.4.0alpha2, php-7.3.7RC3, php-7.3.7RC2, php-7.2.20RC2, php-7.4.0alpha1, php-7.3.7RC1, php-7.2.20RC1, php-7.2.19, php-7.3.6, php-7.1.30, php-7.2.19RC1, php-7.3.6RC1, php-7.1.29, php-7.2.18, php-7.3.5, php-7.2.18RC1, php-7.3.5RC1, php-7.2.17, php-7.3.4, php-7.1.28, php-7.3.4RC1, php-7.2.17RC1, php-7.1.27, php-7.3.3, php-7.2.16, php-7.3.3RC1, php-7.2.16RC1, php-7.2.15, php-7.3.2, php-7.2.15RC1, php-7.3.2RC1, php-5.6.40, php-7.1.26, php-7.3.1, php-7.2.14, php-7.2.14RC1, php-7.3.1RC1, php-5.6.39, php-7.1.25, php-7.2.13, php-7.0.33, php-7.3.0, php-7.1.25RC1, php-7.2.13RC1, php-7.3.0RC6, php-7.1.24, php-7.2.12, php-7.3.0RC5, php-7.1.24RC1, php-7.2.12RC1, php-7.3.0RC4, php-7.1.23, php-7.2.11, php-7.3.0RC3, php-7.1.23RC1, php-7.2.11RC1, php-7.3.0RC2
# 05560b67 18-Sep-2018 Konstantin Kopachev

Fix #76859 stream_get_line skips data if used with data-generating filter

stream_get-line repeatedly calls php_stream_fill_read_buffer until
enough data is accumulated in buffer. However

Fix #76859 stream_get_line skips data if used with data-generating filter

stream_get-line repeatedly calls php_stream_fill_read_buffer until
enough data is accumulated in buffer. However, when stream contains
filters attached to it, then each call to fill buffer essentially
resets buffer read/write pointers and new data is written over old.
This causes stream_get_line to skip parts of data from stream
This patch fixes such behavior, so fill buffer call will append.

show more ...


# 32c20d56 27-Sep-2019 Nikita Popov

Remove unused mmap_file + mmap_len from basic_globals


# 5d6e923d 24-Sep-2019 Gabriel Caruso

Remove mention of PHP major version in Copyright headers

Closes GH-4732.


# 11f3e241 11-Sep-2019 Nikita Popov

Fixed bug #78506


# a18ad194 12-Aug-2019 Nikita Popov

Fixed bug #78396


# dc7aa22b 23-Jul-2019 Albert Casademont

Fix bug #78326

Similar to what fread() does, truncate the stream_get_contents()
result if the original buffer was way too large.


12345678910>>...14