[php-src] Issue #9779: [8.2] `stream_copy_to_stream` doesn't work anymore with resource opened in `a` append mode

From: Date: Wed, 19 Oct 2022 07:42:04 +0000
Subject: [php-src] Issue #9779: [8.2] `stream_copy_to_stream` doesn't work anymore with resource opened in `a` append mode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242626@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9779 Author: Slamdunk ### Description The following code: ```php <?php file_put_contents("./source", "bar"); file_put_contents("./dest", "foo"); $sourceHandle = fopen("./source", "r"); $destHandle = fopen("./dest", "a"); stream_copy_to_stream($sourceHandle, $destHandle); fclose($sourceHandle); fclose($destHandle); echo ("foobar" === file_get_contents("./dest") ? "Ok" : "KO"); ``` Resulted in this output: ``` KO ``` But I expected this output instead: ``` Ok ``` ### PHP Version PHP 8.2.0RC3 (cli) (built: Sep 29 2022 22:31:18) (NTS) ### Operating System Ubuntu 22.04.1

« previous php.bugs (#242626) next »