Skip to content

[pull] master from php:master#1106

Merged
pull[bot] merged 17 commits into
turkdevops:masterfrom
php:master
Jul 19, 2026
Merged

[pull] master from php:master#1106
pull[bot] merged 17 commits into
turkdevops:masterfrom
php:master

Conversation

@pull

@pull pull Bot commented Jul 19, 2026

Copy link
Copy Markdown

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

iliaal and others added 17 commits July 19, 2026 10:43
php_dechunk() accumulated the hex chunk size with chunk_size * 16 + digit and
never checked the multiply, so a size of 2^64 wrapped to 0. A zero size reads
as the terminating chunk, so the filter stopped there and dropped the body it
had been handed. Error out instead, as the other malformed-size cases already
do.

Closes GH-22786
* PHP-8.4:
  ext/standard: reject a dechunk chunk size that overflows size_t
* PHP-8.5:
  ext/standard: reject a dechunk chunk size that overflows size_t
Instead rely on the mechanism gated by the error_include_args INI to display them.

This actually aligns the behaviour of what was accepted in https://wiki.php.net/rfc/display_error_function_args.
This introduces new API for fd copying and modifies
php_stream_copy_to_stream_ex to use it. The implementation is separated
for various platforms and the end result have couple of implications:

- sendfile is used for copying file to generic fd (e.g. sockets) on all
  platforms except Windows that use TransmitFile
- splice is used for copying between generic fds (e.g. sockets) on
  Linux
- copy_file_range should get used on alpine linux with directly using
  syscall (as musl does not seem to implement it)
- copy_file_range is used in the loop so it is used multiple times for
  files bigger than 2GB on Linux.
- file mmap for copying is removed as it allowed crashing PHP when
  another process modified mapped file - this was used as a fallback
  for file copying. Sendfile should partially replace it.
- File to file copying was optimized on Windows with use of ReadFile
  and WriteFile.

This also adds various tests including Linux unit tests.

Closes GH-20399

Co-authored-by: David Carlier <devnexen@gmail.com>
Split API changes into Removed, Changed, and Added
…ing (#22806)

Rather than when attempting to create an instance of it within the stream layer.
Use `uint32_t` for values that are really `uint32_t`, like constant module
numbers and the result from `zend_hash_num_elements()`. Use `uint32_t` for
counting up, when values should never be negative. Adjust format specifiers to
use `PRIu32` rather than `%d` for the uint32_t values.
Put the `*` next to the name, rather than the type
Avoid tabs or multiple spaces other than for indentation, remove a leading
newline from `ReflectionProperty::hasHook()`
Propagate changes up which means we can also voidify php_init_stream_wrappers() removing an if() check during startup.
This removes a strlen() call when we already know the length of the string
@pull pull Bot locked and limited conversation to collaborators Jul 19, 2026
@pull pull Bot added the ⤵️ pull label Jul 19, 2026
@pull
pull Bot merged commit 5c4bff6 into turkdevops:master Jul 19, 2026
0 of 2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants