Annotation of embedaddon/php/ext/standard/tests/file/bug37158.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #37158 (if userspace stream is present, fread() reads in 8192 max, otherwise it works)
3: --FILE--
4: <?php
5:
6: class VariableStream {
7:
8: function stream_open($path, $mode, $options, &$opened_path)
9: {
10: return true;
11: }
12: }
13:
14: stream_wrapper_register("var", "VariableStream");
15:
16: error_reporting(E_ALL | E_STRICT);
17: $file = dirname(__FILE__) . '/footest.txt';
18: $x = str_repeat(1, 8192);
19: $fp = fopen($file, 'w');
20: for ($i = 0; $i < 5; $i++) {
21: fwrite($fp, $x);
22: }
23: fclose($fp);
24:
25: $fp = fopen($file, 'r');
26: $outsidecontents = fread($fp, 20000);
27: fclose($fp);
28: var_dump('size of contents 1 = ' . strlen($outsidecontents));
29: $outsidecontents = file_get_contents($file);
30: var_dump('size of contents 2 = ' . strlen($outsidecontents));
31:
32: unlink($file);
33:
34: echo "Done\n";
35: ?>
36: --EXPECT--
37: string(26) "size of contents 1 = 20000"
38: string(26) "size of contents 2 = 40960"
39: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>