xref: /php-src/ext/standard/tests/file/gh9779.phpt (revision b732d803)
1--TEST--
2Bug GH-9779 (stream_copy_to_stream doesn't work anymore with resource opened in a append mode)
3--FILE--
4<?php
5
6$src = __DIR__.'/gh9779_src.txt';
7$dest = __DIR__.'/gh9779_dest.txt';
8
9file_put_contents($src, "bar");
10file_put_contents($dest, "foo");
11$sourceHandle = fopen($src, "r");
12$destHandle = fopen($dest, "a");
13stream_copy_to_stream($sourceHandle, $destHandle);
14fclose($sourceHandle);
15fclose($destHandle);
16var_dump(file_get_contents($dest));
17?>
18--CLEAN--
19<?php
20$src = __DIR__.'/gh9779_src.txt';
21$dest = __DIR__.'/gh9779_dest.txt';
22
23@unlink($src);
24@unlink($dest);
25?>
26--EXPECTF--
27string(6) "foobar"
28