gztell_basic2.phpt 743 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. --TEST--
  2. Test function gztell() by calling it with its expected arguments when writing
  3. --SKIPIF--
  4. <?php
  5. if (!extension_loaded("zlib")) {
  6. print "skip - ZLIB extension not loaded";
  7. }
  8. ?>
  9. --FILE--
  10. <?php
  11. $f = "temp2.txt.gz";
  12. $h = gzopen($f, 'w');
  13. $sizes = array(7, 22, 54, 17, 27, 15, 1000);
  14. // tell should be 7, 29, 83, 100, 127, 142, 1142
  15. var_dump(gztell($h));
  16. foreach ($sizes as $size) {
  17. echo "bytes written=".gzwrite($h, str_repeat(b'1', $size))."\n";;
  18. echo "tell=".gztell($h)."\n";
  19. }
  20. gzclose($h);
  21. unlink($f);
  22. ?>
  23. ===DONE===
  24. --EXPECT--
  25. int(0)
  26. bytes written=7
  27. tell=7
  28. bytes written=22
  29. tell=29
  30. bytes written=54
  31. tell=83
  32. bytes written=17
  33. tell=100
  34. bytes written=27
  35. tell=127
  36. bytes written=15
  37. tell=142
  38. bytes written=1000
  39. tell=1142
  40. ===DONE===