gzclose_basic.phpt 717 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Test function gzclose() by calling it with its expected arguments
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. // note that gzclose is an alias to fclose. parameter checking tests will be
  12. // the same as fclose
  13. $f = dirname(__FILE__)."/004.txt.gz";
  14. $h = gzopen($f, 'r');
  15. gzread($h, 20);
  16. var_dump(gzclose($h));
  17. //should fail.
  18. gzread($h, 20);
  19. $h = gzopen($f, 'r');
  20. gzread($h, 20);
  21. var_dump(fclose($h));
  22. //should fail.
  23. gzread($h, 20);
  24. ?>
  25. ===DONE===
  26. --EXPECTF--
  27. bool(true)
  28. Warning: gzread(): %d is not a valid stream resource in %s on line %d
  29. bool(true)
  30. Warning: gzread(): %d is not a valid stream resource in %s on line %d
  31. ===DONE===