Skip to content

stream_copy_to_stream: document offset and socket timeout behavior - #5860

Merged
lacatoire merged 1 commit into
php:masterfrom
lacatoire:stream-copy-to-stream-offset-timeout
Sep 24, 2026
Merged

lacatoire merged 1 commit into
php:masterfrom
lacatoire:stream-copy-to-stream-offset-timeout

Conversation

@lacatoire

Copy link
Copy Markdown
Member

The offset description didn't say that 0 (the default) keeps the current position while a positive value seeks from the start of the stream, and nothing mentioned that copying from a blocking socket stops on the stream timeout.

Fixes: #2026
Fixes: #2046
Fixes: #2414

A zero or negative offset keeps the current position, a positive one
seeks from the start of the stream. Copying from a blocking socket stops
when the stream timeout is reached, and false may be returned even though
data has already been written to the destination.
@lacatoire
lacatoire force-pushed the stream-copy-to-stream-offset-timeout branch from 44dddeb to 95d91de Compare September 15, 2026 09:28
@lacatoire
lacatoire merged commit a88dc81 into php:master Sep 24, 2026
3 checks passed
@lacatoire
lacatoire deleted the stream-copy-to-stream-offset-timeout branch September 24, 2026 09:21
KentarouTakeda added a commit to KentarouTakeda/php-doc-ja that referenced this pull request Sep 24, 2026
stream と sockets の 4 ファイルを原文の変更に追従しました。これで stream と sockets モジュールの未訳・要更新はなくなります。

- `socket_select()` に配列のキーが保持されることが追記され、配列を省略できるとしていた記述などが直されました。`stream_select()` には、`socket_select()` と同じには動かないことと、PHP 側のバッファにデータがあると `select()` を呼ばずに戻ることが追記されました(php/doc-en@3e6082f、php/doc-en#5829)
- `stream_copy_to_stream()` に、`offset` が 0 以下なら現在の位置からコピーすることと、ブロックモードのソケットではタイムアウトでコピーが終わり、書き込み済みでも `false` が返ることがあることが追記されました(php/doc-en@a88dc81、php/doc-en#5860)
- スタブだった `socket_sendmsg()` のページに、説明・パラメータ・例が書かれました(php/doc-en@30b010f、php/doc-en#2039)

## 対象ファイル

reference/stream/ (2) — functions/stream-copy-to-stream.xml, functions/stream-select.xml
reference/sockets/ (2) — functions/socket-select.xml, functions/socket-sendmsg.xml
KentarouTakeda added a commit to KentarouTakeda/php-doc-ja that referenced this pull request Sep 24, 2026
stream と sockets の 4 ファイルを原文の変更に追従しました。これで stream と sockets モジュールの未訳・要更新はなくなります。

- `socket_select()` に配列のキーが保持されることが追記され、配列を省略できるとしていた記述などが直されました。`stream_select()` には、`socket_select()` と同じには動かないことと、PHP 側のバッファにデータがあると `select()` を呼ばずに戻ることが追記されました(php/doc-en@3e6082f、php/doc-en#5829)
- `stream_copy_to_stream()` に、`offset` が 0 以下なら現在の位置からコピーすることと、ブロックモードのソケットではタイムアウトでコピーが終わり、書き込み済みでも `false` が返ることがあることが追記されました(php/doc-en@a88dc81、php/doc-en#5860)
- スタブだった `socket_sendmsg()` のページに、説明・パラメータ・例が書かれました(php/doc-en@30b010f、php/doc-en#2039)

## 対象ファイル

reference/stream/ (2) — functions/stream-copy-to-stream.xml, functions/stream-select.xml
reference/sockets/ (2) — functions/socket-select.xml, functions/socket-sendmsg.xml
KentarouTakeda added a commit to KentarouTakeda/php-doc-ja that referenced this pull request Sep 24, 2026
stream と sockets の 4 ファイルを原文の変更に追従しました。これで stream と sockets モジュールの未訳・要更新はなくなります。

- `socket_select()` に配列のキーが保持されることが追記され、配列を省略できるとしていた記述などが直されました。`stream_select()` には、`socket_select()` と同じには動かないことと、PHP 側のバッファにデータがあると `select()` を呼ばずに戻ることが追記されました(php/doc-en@3e6082f、php/doc-en#5829)
- `stream_copy_to_stream()` に、`offset` が 0 以下なら現在の位置からコピーすることと、ブロックモードのソケットではタイムアウトでコピーが終わり、書き込み済みでも `false` が返ることがあることが追記されました(php/doc-en@a88dc81、php/doc-en#5860)
- スタブだった `socket_sendmsg()` のページに、説明・パラメータ・例が書かれました(php/doc-en@30b010f、php/doc-en#2039)

`socket_cmsg_space()` は原文が変わっていませんが、ancillary data の訳語を `socket_sendmsg()` と同じ「補助データ」に揃えています。

## 対象ファイル

reference/stream/ (2) — functions/stream-copy-to-stream.xml, functions/stream-select.xml
reference/sockets/ (3) — functions/socket-cmsg-space.xml, functions/socket-select.xml, functions/socket-sendmsg.xml
KentarouTakeda added a commit to php/doc-ja that referenced this pull request Sep 24, 2026
stream と sockets の 4 ファイルを原文の変更に追従しました。これで stream と sockets モジュールの未訳・要更新はなくなります。

- `socket_select()` に配列のキーが保持されることが追記され、配列を省略できるとしていた記述などが直されました。`stream_select()` には、`socket_select()` と同じには動かないことと、PHP 側のバッファにデータがあると `select()` を呼ばずに戻ることが追記されました(php/doc-en@3e6082f、php/doc-en#5829)
- `stream_copy_to_stream()` に、`offset` が 0 以下なら現在の位置からコピーすることと、ブロックモードのソケットではタイムアウトでコピーが終わり、書き込み済みでも `false` が返ることがあることが追記されました(php/doc-en@a88dc81、php/doc-en#5860)
- スタブだった `socket_sendmsg()` のページに、説明・パラメータ・例が書かれました(php/doc-en@30b010f、php/doc-en#2039)

`socket_cmsg_space()` は原文が変わっていませんが、ancillary data の訳語を `socket_sendmsg()` と同じ「補助データ」に揃えています。

## 対象ファイル

reference/stream/ (2) — functions/stream-copy-to-stream.xml, functions/stream-select.xml
reference/sockets/ (3) — functions/socket-cmsg-space.xml, functions/socket-select.xml, functions/socket-sendmsg.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant