Annotation of embedaddon/php/ext/standard/tests/file/bug38086.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #38086 (stream_copy_to_stream() returns 0 when maxlen is bigger than the actual length)
3: --FILE--
4: <?php
5: define('WIN', substr(PHP_OS, 0, 3) == 'WIN');
6:
7: $initial_file = dirname(__FILE__).'/bug38086.txt';
8: $new_file = dirname(__FILE__).'/bug38086_1.txt';
9:
10: $src = fopen($initial_file, 'r');
11: stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
12:
13: $dest = fopen($new_file, 'w');
14: var_dump(stream_copy_to_stream($src, $dest));
15: fclose($src); fclose($dest);
16:
17: if (WIN) {
18: var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
19: } else {
20: var_dump(file_get_contents($new_file));
21: }
22: unlink($new_file);
23:
24: $src = fopen($initial_file, 'r');
25: stream_filter_append($src, "string.rot13", STREAM_FILTER_READ);
26:
27: $dest = fopen($new_file, 'w');
28: var_dump(stream_copy_to_stream($src, $dest, 10000));
29: fclose($src); fclose($dest);
30:
31: if (WIN) {
32: var_dump(str_replace("\r\n","\n", file_get_contents($new_file)));
33: } else {
34: var_dump(file_get_contents($new_file));
35: }
36: unlink($new_file);
37:
38: echo "Done\n";
39: ?>
40: --EXPECTF--
41: int(%d)
42: string(134) "Nabgure qnl
43: Jura gur cnvaf bs yvsr jba'g one zl jnl
44: V'yy oernx gurfr punvaf
45: Gung ubyq zr qbja
46: V'yy grne lbh qbja vagb zl cevingr uryy
47: "
48: int(%d)
49: string(134) "Nabgure qnl
50: Jura gur cnvaf bs yvsr jba'g one zl jnl
51: V'yy oernx gurfr punvaf
52: Gung ubyq zr qbja
53: V'yy grne lbh qbja vagb zl cevingr uryy
54: "
55: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>