History log of /php-src/main/streams/streams.c (Results 1 – 25 of 423)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# c087398c 23-Mar-2024 Jakub Zelenka

Fix GH-13264: Part 1 - Memory leak on filter failure

Closes GH-13790


# 5e9e9c9d 12-Jan-2024 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail

Commit 5cbe5a538c disabled chunking for all writes to streams. However,
user stream

Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail

Commit 5cbe5a538c disabled chunking for all writes to streams. However,
user streams have a callback where code is executed on data that is
subject to the memory limit. Therefore, when using large writes or
stream_copy_to_stream/copy the memory limit can easily be hit with large
enough data.

To solve this, we reintroduce chunking for userspace streams.
Users have control over the chunk size, which is neat because
they can improve the performance by setting the chunk size if
that turns out to be a bottleneck.

In an ideal world, we add an option so we can "ask" the stream whether
it "prefers" chunked writes, similar to how we have
php_stream_mmap_supported & friends. However, that cannot be done on
stable branches.

Closes GH-13136.

show more ...


# 6734880e 16-Nov-2023 Jakub Zelenka

Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault

Closes GH-12696


# 26d6bb36 27-Aug-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove useless duplicated call to php_stream_parse_fopen_modes (#12059)


# 4a5d13e2 07-Jul-2023 Jakub Zelenka

Fix GH-11242: Use dynamic buffer for large length in stream mem copy


# 49fbbea2 10-Jun-2023 Jakub Zelenka

Fix GH-10406: fgets on a redis socket connection fails on PHP 8.3

This is an alternative implementation for GH-10406 that resets the
has_buffered_data flag after finishing stream read so

Fix GH-10406: fgets on a redis socket connection fails on PHP 8.3

This is an alternative implementation for GH-10406 that resets the
has_buffered_data flag after finishing stream read so it does not impact
other ops->read use like for example php_stream_get_line.

Closes GH-11421

show more ...


# d22d0e26 04-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Implement GH-8641: STREAM_NOTIFY_COMPLETED over HTTP never emitted

This adds support for the completed event. Since the read handler could
be entered twice towards the end of the stream

Implement GH-8641: STREAM_NOTIFY_COMPLETED over HTTP never emitted

This adds support for the completed event. Since the read handler could
be entered twice towards the end of the stream we remember what the eof
flag was before reading so we can emit the completed event when the flag
changes to true.

Closes GH-10505.

show more ...


# acc94064 09-May-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Remove unnecessary NULL assignments after ecalloc in streams (#11209)

ecalloc already zeroes the structure, so writing NULL is not necessary.


# 732d92c0 28-Apr-2023 Javier Eguiluz

[skip ci] Fix various typos and grammar issues (#11143)


# e787d6c9 11-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() (#10551)

On some filesystems, the copy operation fails if we spe

Fix GH-10548: copy() fails on cifs mounts because of incorrect length (cfr_max) specified in streams.c:1584 copy_file_range() (#10551)

On some filesystems, the copy operation fails if we specify a size
larger than the file size in certain circumstances and configurations.
In those cases EIO will be returned as errno and we will therefore fall
back to other methods.

show more ...


# b4db690c 10-Feb-2023 Niels Dossche <7771979+nielsdos@users.noreply.github.com>

Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)

copy_file_range can return early without copying all the data. This is
legal behaviour

Fix GH-10370: File corruption in _php_stream_copy_to_stream_ex when using copy_file_range (#10440)

copy_file_range can return early without copying all the data. This is
legal behaviour and worked properly, unless the mmap fallback was used.
The mmap fallback would read too much data into the destination,
corrupting the destination file. Furthermore, if the mmap fallback would
fail and have to fallback to the regular file copying mechanism, a
similar issue would occur because both maxlen and haveread are modified.
Furthermore, there was a mmap-resource in one of the failure paths of
the mmap fallback code.
This patch fixes these issues. This also adds regression tests using the
new copy_file_range early-return simulation added in the previous
commit.

show more ...


# c8955c07 16-Jan-2023 Christoph M. Becker

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07

Revert GH-10220

Cf. <https://github.com/php/php-src/pull/10220#issuecomment-1383739816>.

This reverts commit ecc880f491d66081298a16634629f149459706a9.
This reverts commit 588a07f7371ee2b5fac17de147926780e427fae6.
This reverts commit f377e15751d3aa48b69cd9bcc366ede7803d511f.
This reverts commit b4ba16fe189b109144aff669e11d81365160104b.
This reverts commit 694ec1deea36e366b28b6349a52be49824e1a1a8.
This reverts commit 6b34de8eba9f66882ae16e6073af28783670ac53.
This reverts commit aa1cd02a4367834026ea2205ea13a2f904455aa1.
This reverts commit 308fd311ea6fcf3094b448df7f2b264f08e4fe4f.
This reverts commit 16203b53e1822a37b6ba6f2ab198bb435d05fdad.
This reverts commit 738fb5ca5412f5e833a7fab82b11519e635a3357.
This reverts commit 9fdbefacd3c382d731aa175b7bdc002ec9cb2b30.
This reverts commit cd4a7c1d90562ebb5f89caf94d00d579631b9fbe.
This reverts commit 928685eba2b2f0ded90e7f78fd806ea164002f6e.
This reverts commit 01e5ffc85cd4357fd7b5b7ceefa29f2d10ca26b7.

show more ...


# 16203b53 04-Jan-2023 Max Kellermann

main: add missing includes


# b732d803 22-Oct-2022 Jakub Zelenka

Fix bug GH-9779: stream_copy_to_stream fail when dest in append mode


# 18fe337b 05-Oct-2022 Jakub Zelenka

Fix bug #51056: fread() on blocking stream will block even if data is available

This is applied only on socket connection which already returns
immediately if there is no data in the buf

Fix bug #51056: fread() on blocking stream will block even if data is available

This is applied only on socket connection which already returns
immediately if there is no data in the buffer.

show more ...


# d0b3096f 12-Sep-2022 Dmitry Stogov

Reset FG(user_stream_current_filename) at the end of request

Attempt to fix oss-fuzz #51047


Revision tags: php-8.2.0RC1, php-8.1.10, php-8.0.23, php-8.0.23RC1, php-8.1.10RC1, php-8.2.0beta3, php-8.2.0beta2, php-8.1.9, php-8.0.22, php-8.1.9RC1, php-8.2.0beta1, php-8.0.22RC1, php-8.0.21, php-8.1.8, php-8.2.0alpha3, php-8.1.8RC1, php-8.2.0alpha2, php-8.0.21RC1
# 0a4a55fd 20-Jun-2022 Jakub Zelenka

Allow to not close stream on rscr dtor in php cli sapi

Revision tags: php-8.0.20, php-8.1.7, php-8.2.0alpha1, php-7.4.30, php-8.1.7RC1, php-8.0.20RC1, php-8.1.6, php-8.0.19, php-8.1.6RC1, php-8.0.19RC1
# fa6d97db 23-Apr-2022 Max Kellermann

main/streams/streams: use copy_file_range() on Linux (#8413)

copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating th

main/streams/streams: use copy_file_range() on Linux (#8413)

copy_file_range() is a Linux-specific system call which allows
efficient copying between two file descriptors, eliminating the need
to transfer data from the kernel to userspace and back. For
networking file systems like NFS and Ceph, it even eliminates copying
data to the client, and local filesystems like Btrfs and XFS can
create shared extents.

show more ...

Revision tags: php-8.0.18, php-8.1.5, php-7.4.29, php-8.1.5RC1, php-8.0.18RC1, php-8.1.4, php-8.0.17, php-8.1.4RC1, php-8.0.17RC1, php-8.1.3, php-8.0.16, php-7.4.28, php-8.1.3RC1, php-8.0.16RC1, php-8.1.2, php-8.0.15, php-8.1.2RC1, php-8.0.15RC1, php-8.0.14, php-8.1.1, php-7.4.27, php-8.1.1RC1, php-8.0.14RC1, php-7.4.27RC1
# e73cccd9 29-Nov-2021 Christoph M. Becker

Merge branch 'PHP-8.1'

* PHP-8.1:
Fix #81659: stream_get_contents() may unnecessarily overallocate


# b0823438 29-Nov-2021 Christoph M. Becker

Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
Fix #81659: stream_get_contents() may unnecessarily overallocate


# f3bd24a2 29-Nov-2021 Christoph M. Becker

Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
Fix #81659: stream_get_contents() may unnecessarily overallocate


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

# 067df263 24-Nov-2021 Dmitry Stogov

Use memrchr() when available

On x86_64 glibc memrchr() uses SSE/AVX CPU extensions and works much
faster then naive loop. On x86 32-bit we still use inlined version.

memrchr() i

Use memrchr() when available

On x86_64 glibc memrchr() uses SSE/AVX CPU extensions and works much
faster then naive loop. On x86 32-bit we still use inlined version.

memrchr() is a GNU extension. Its prototype becomes available when
<string.h> is included with defined _GNU_SOURCE macro. Previously, we
defined it in "php_config.h", but some sources may include <string.h>
befire it. To avod mess we also pass -D_GNU_SOURCE to C compiler.

show more ...

Revision tags: php-8.1.0, php-8.0.13, php-7.4.26, php-7.3.33, php-8.1.0RC6, php-7.4.26RC1, php-8.0.13RC1, php-8.1.0RC5, php-7.3.32, php-7.4.25, php-8.0.12, php-8.1.0RC4, php-8.0.12RC1, php-7.4.25RC1, php-8.1.0RC3
# 605ac464 24-Sep-2021 Nikita Popov

Merge branch 'PHP-8.1'

* PHP-8.1:
Use ASCII lower case for misc case folding


# c96be7b8 24-Sep-2021 Tim Starling

Use ASCII lower case for misc case folding

Use ASCII case conversion instead of locale-dependent case conversion in
the following places:

* grapheme_stripos() and grapheme_strri

Use ASCII lower case for misc case folding

Use ASCII case conversion instead of locale-dependent case conversion in
the following places:

* grapheme_stripos() and grapheme_strripos() in the "fast" path
* ldap_get_entries()
* oci_pconnect() for case folding of parameters when constructing a key
into the connection or session pool
* SoapClient: case folding of function names
* get_meta_tags(): case conversion of property names
* http stream wrapper: header names
* phpinfo(): anchor names
* php_verror(): docref URLs
* rfc1867.c: Content-Type boundary parameter name
* streams.c: stream protocol names

Using locale-dependent case folding for these cases is either
unnecessary or actively incorrect. These functions could have
misbehaved when used with certain locales (e.g. Turkish).

Closes GH-7511.

show more ...

12345678910>>...17