gzeof_basic.phpt 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. --TEST--
  2. Test function feof() by calling it with its expected arguments
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. // note that gzeof is an alias to gzeof. parameter checking tests will be
  8. // the same as gzeof
  9. $f = __DIR__."/004.txt.gz";
  10. echo "-- test 1 --\n";
  11. $h = gzopen($f, 'r');
  12. var_dump(gzeof($h));
  13. gzpassthru($h);
  14. var_dump(gzeof($h));
  15. gzclose($h);
  16. echo "\n-- test 2 --\n";
  17. $h = gzopen($f, 'r');
  18. echo "reading 50 characters. eof should be false\n";
  19. gzread($h, 50)."\n";
  20. var_dump(gzeof($h));
  21. echo "reading 250 characters. eof should be true\n";
  22. gzread($h, 250)."\n";
  23. var_dump(gzeof($h));
  24. echo "reading 20 characters. eof should be true still\n";
  25. gzread($h, 20)."\n";
  26. var_dump(gzeof($h));
  27. gzclose($h);
  28. ?>
  29. --EXPECT--
  30. -- test 1 --
  31. bool(false)
  32. When you're taught through feelings
  33. Destiny flying high above
  34. all I know is that you can realize it
  35. Destiny who cares
  36. as it turns around
  37. and I know that it descends down on me
  38. bool(true)
  39. -- test 2 --
  40. reading 50 characters. eof should be false
  41. bool(false)
  42. reading 250 characters. eof should be true
  43. bool(true)
  44. reading 20 characters. eof should be true still
  45. bool(true)