path: root/ext/zlib/tests/gzseek_variation4.phpt
diff options
authorDave Kelsey <>2009-01-19 14:03:08 (GMT)
committerDave Kelsey <>2009-01-19 14:03:08 (GMT)
commit8f9ec4238fa879ab7bc4adb5c42a222b929c3b60 (patch)
treea5c6e17e512963f68d6933ceebca218b55a26487 /ext/zlib/tests/gzseek_variation4.phpt
parent357ed77aeaeaf45885d372b061b67110fe04dc76 (diff)
new tests for zlib extension, tested on windows, linux and linux64
Diffstat (limited to 'ext/zlib/tests/gzseek_variation4.phpt')
1 files changed, 42 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzseek_variation4.phpt b/ext/zlib/tests/gzseek_variation4.phpt
new file mode 100644
index 0000000..fc641f6
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation4.phpt
@@ -0,0 +1,42 @@
+Test function gzseek() by calling it with SEEK_SET when writing
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+$f = "temp3.txt.gz";
+$h = gzopen($f, 'w');
+$str1 = "This is the first line.";
+$str2 = "This is the second line.";
+gzwrite($h, $str1);
+echo "tell=".gztell($h)."\n";
+//seek forwards 20 bytes.
+gzseek($h, strlen($str1) + 20, SEEK_SET);
+echo "tell=".gztell($h)."\n";
+gzwrite($h, $str2);
+echo "tell=".gztell($h)."\n";
+echo "\nreading the output file\n";
+$h = gzopen($f, 'r');
+echo gzread($h, strlen($str1))."\n";
+echo var_dump(bin2hex(gzread($h, 20)));
+echo gzread($h, strlen($str2))."\n";
+reading the output file
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file