gzopen_variation9.phpt 897 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. --TEST--
  2. Test gzopen() function : variation: try opening with possibly invalid modes
  3. --EXTENSIONS--
  4. zlib
  5. --FILE--
  6. <?php
  7. echo "*** Testing gzopen() : variation ***\n";
  8. $modes = array('r+', 'rf', 'w+' , 'e');
  9. $file = __DIR__."/004.txt.gz";
  10. foreach ($modes as $mode) {
  11. echo "mode=$mode\n";
  12. $h = gzopen($file, $mode);
  13. echo "gzopen=";
  14. var_dump($h);
  15. if ($h !== false) {
  16. gzclose($h);
  17. }
  18. echo "\n";
  19. }
  20. ?>
  21. --EXPECTF--
  22. *** Testing gzopen() : variation ***
  23. mode=r+
  24. Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
  25. gzopen=bool(false)
  26. mode=rf
  27. gzopen=resource(%d) of type (stream)
  28. mode=w+
  29. Warning: gzopen(): Cannot open a zlib stream for reading and writing at the same time! in %s on line %d
  30. gzopen=bool(false)
  31. mode=e
  32. Warning: gzopen(%s/004.txt.gz): Failed to open stream: %s in %s on line %d
  33. gzopen=bool(false)