bug37158.phpt 814 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Bug #37158 (if userspace stream is present, fread() reads in 8192 max, otherwise it works)
  3. --FILE--
  4. <?php
  5. class VariableStream {
  6. function stream_open($path, $mode, $options, &$opened_path)
  7. {
  8. return true;
  9. }
  10. }
  11. stream_wrapper_register("var", "VariableStream");
  12. $file = __DIR__ . '/footest.txt';
  13. $x = str_repeat(1, 8192);
  14. $fp = fopen($file, 'w');
  15. for ($i = 0; $i < 5; $i++) {
  16. fwrite($fp, $x);
  17. }
  18. fclose($fp);
  19. $fp = fopen($file, 'r');
  20. $outsidecontents = fread($fp, 20000);
  21. fclose($fp);
  22. var_dump('size of contents 1 = ' . strlen($outsidecontents));
  23. $outsidecontents = file_get_contents($file);
  24. var_dump('size of contents 2 = ' . strlen($outsidecontents));
  25. unlink($file);
  26. echo "Done\n";
  27. ?>
  28. --EXPECT--
  29. string(26) "size of contents 1 = 20000"
  30. string(26) "size of contents 2 = 40960"
  31. Done