xref: /PHP-8.1/ext/standard/tests/file/bug69100.phpt (revision b864abfe)
1--TEST--
2Bug #69100: Bus error from stream_copy_to_stream (file -> SSL stream) with invalid length
3--FILE--
4<?php
5
6$fileIn = __DIR__ . '/bug69100_in.txt';
7$fileOut = __DIR__ . '/bug69100_out.txt';
8
9file_put_contents($fileIn, str_repeat('A', 64 * 1024));
10$fr = fopen($fileIn, 'rb');
11$fw = fopen($fileOut, 'w');
12
13var_dump(stream_copy_to_stream($fr, $fw, 32 * 1024));
14var_dump(stream_copy_to_stream($fr, $fw, 64 * 1024));
15
16fclose($fr);
17fclose($fw);
18unlink($fileIn);
19unlink($fileOut);
20
21?>
22--EXPECT--
23int(32768)
24int(32768)
25