gzclose_basic.phpt 720 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. Test function gzclose() by calling it with its expected arguments
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. // note that gzclose is an alias to fclose. parameter checking tests will be
  8. // the same as fclose
  9. $f = __DIR__."/004.txt.gz";
  10. $h = gzopen($f, 'r');
  11. gzread($h, 20);
  12. var_dump(gzclose($h));
  13. //should fail.
  14. try {
  15. gzread($h, 20);
  16. } catch (TypeError $e) {
  17. echo $e->getMessage(), "\n";
  18. }
  19. $h = gzopen($f, 'r');
  20. gzread($h, 20);
  21. var_dump(fclose($h));
  22. //should fail.
  23. try {
  24. gzread($h, 20);
  25. } catch (TypeError $e) {
  26. echo $e->getMessage(), "\n";
  27. }
  28. ?>
  29. --EXPECT--
  30. bool(true)
  31. gzread(): supplied resource is not a valid stream resource
  32. bool(true)
  33. gzread(): supplied resource is not a valid stream resource