summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/tests/gzclose_basic.phpt39
-rw-r--r--ext/zlib/tests/gzclose_error.phpt33
-rw-r--r--ext/zlib/tests/gzeof_basic.phpt58
-rw-r--r--ext/zlib/tests/gzeof_error.phpt28
-rw-r--r--ext/zlib/tests/gzeof_variation1.phpt31
-rw-r--r--ext/zlib/tests/gzfile_basic.phpt39
-rw-r--r--ext/zlib/tests/gzfile_basic2.phpt39
-rw-r--r--ext/zlib/tests/gzfile_error.phpt29
-rw-r--r--ext/zlib/tests/gzfile_variation1.phpt43
-rw-r--r--ext/zlib/tests/gzfile_variation10.phpt119
-rw-r--r--ext/zlib/tests/gzfile_variation11.phpt129
-rw-r--r--ext/zlib/tests/gzfile_variation12.phpt108
-rw-r--r--ext/zlib/tests/gzfile_variation13.phpt51
-rw-r--r--ext/zlib/tests/gzfile_variation14.phpt44
-rw-r--r--ext/zlib/tests/gzfile_variation15.phpt109
-rw-r--r--ext/zlib/tests/gzfile_variation2.phpt40
-rw-r--r--ext/zlib/tests/gzfile_variation3.phpt50
-rw-r--r--ext/zlib/tests/gzfile_variation4.phpt43
-rw-r--r--ext/zlib/tests/gzfile_variation5.phpt39
-rw-r--r--ext/zlib/tests/gzfile_variation6.phpt49
-rw-r--r--ext/zlib/tests/gzfile_variation7.phpt44
-rw-r--r--ext/zlib/tests/gzfile_variation8.phpt43
-rw-r--r--ext/zlib/tests/gzfile_variation9.phpt107
-rw-r--r--ext/zlib/tests/gzgetc_basic.phpt38
-rw-r--r--ext/zlib/tests/gzgetc_error.phpt29
-rw-r--r--ext/zlib/tests/gzgets_basic.phpt46
-rw-r--r--ext/zlib/tests/gzgets_error.phpt30
-rw-r--r--ext/zlib/tests/gzopen_basic.phpt51
-rw-r--r--ext/zlib/tests/gzopen_basic2.phpt52
-rw-r--r--ext/zlib/tests/gzopen_error.phpt47
-rw-r--r--ext/zlib/tests/gzopen_include_path.inc92
-rw-r--r--ext/zlib/tests/gzopen_variation1.phpt228
-rw-r--r--ext/zlib/tests/gzopen_variation2.phpt227
-rw-r--r--ext/zlib/tests/gzopen_variation3.phpt218
-rw-r--r--ext/zlib/tests/gzopen_variation4.phpt161
-rw-r--r--ext/zlib/tests/gzopen_variation5.phpt71
-rw-r--r--ext/zlib/tests/gzopen_variation6.phpt47
-rw-r--r--ext/zlib/tests/gzopen_variation7.phpt31
-rw-r--r--ext/zlib/tests/gzpassthru_basic.phpt32
-rw-r--r--ext/zlib/tests/gzpassthru_error.phpt29
-rw-r--r--ext/zlib/tests/gzputs_basic.phpt31
-rw-r--r--ext/zlib/tests/gzread_basic.phpt37
-rw-r--r--ext/zlib/tests/gzread_error.phpt32
-rw-r--r--ext/zlib/tests/gzread_error2.phpt32
-rw-r--r--ext/zlib/tests/gzread_variation1.phpt34
-rw-r--r--ext/zlib/tests/gzrewind_basic.phpt36
-rw-r--r--ext/zlib/tests/gzrewind_basic2.phpt34
-rw-r--r--ext/zlib/tests/gzrewind_error.phpt27
-rw-r--r--ext/zlib/tests/gzrewind_variation1.phpt28
-rw-r--r--ext/zlib/tests/gzseek_basic.phpt49
-rw-r--r--ext/zlib/tests/gzseek_basic2.phpt42
-rw-r--r--ext/zlib/tests/gzseek_error.phpt33
-rw-r--r--ext/zlib/tests/gzseek_variation1.phpt33
-rw-r--r--ext/zlib/tests/gzseek_variation2.phpt49
-rw-r--r--ext/zlib/tests/gzseek_variation3.phpt50
-rw-r--r--ext/zlib/tests/gzseek_variation4.phpt42
-rw-r--r--ext/zlib/tests/gzseek_variation5.phpt42
-rw-r--r--ext/zlib/tests/gztell_basic.phpt34
-rw-r--r--ext/zlib/tests/gztell_basic2.phpt42
-rw-r--r--ext/zlib/tests/gztell_error.phpt26
-rw-r--r--ext/zlib/tests/gzwrite_basic.phpt31
-rw-r--r--ext/zlib/tests/gzwrite_error.phpt35
-rw-r--r--ext/zlib/tests/gzwrite_error2.phpt30
-rw-r--r--ext/zlib/tests/gzwrite_variation1.phpt27
-rw-r--r--ext/zlib/tests/readgzfile_basic.phpt34
-rw-r--r--ext/zlib/tests/readgzfile_basic2.phpt34
-rw-r--r--ext/zlib/tests/readgzfile_error.phpt29
-rw-r--r--ext/zlib/tests/readgzfile_variation1.phpt43
-rw-r--r--ext/zlib/tests/readgzfile_variation10.phpt67
-rw-r--r--ext/zlib/tests/readgzfile_variation11.phpt64
-rw-r--r--ext/zlib/tests/readgzfile_variation12.phpt56
-rw-r--r--ext/zlib/tests/readgzfile_variation13.phpt51
-rw-r--r--ext/zlib/tests/readgzfile_variation14.phpt44
-rw-r--r--ext/zlib/tests/readgzfile_variation15.phpt94
-rw-r--r--ext/zlib/tests/readgzfile_variation2.phpt40
-rw-r--r--ext/zlib/tests/readgzfile_variation3.phpt50
-rw-r--r--ext/zlib/tests/readgzfile_variation4.phpt34
-rw-r--r--ext/zlib/tests/readgzfile_variation5.phpt32
-rw-r--r--ext/zlib/tests/readgzfile_variation6.phpt48
-rw-r--r--ext/zlib/tests/readgzfile_variation7.phpt36
-rw-r--r--ext/zlib/tests/readgzfile_variation8.phpt43
-rw-r--r--ext/zlib/tests/readgzfile_variation9.phpt55
-rw-r--r--ext/zlib/tests/reading_include_path.inc27
-rw-r--r--ext/zlib/tests/zlib_wrapper_fflush_basic.phpt33
-rw-r--r--ext/zlib/tests/zlib_wrapper_flock_basic.phpt19
-rw-r--r--ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt32
-rw-r--r--ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt65
87 files changed, 4629 insertions, 0 deletions
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
new file mode 100644
index 0000000..d61855b
--- /dev/null
+++ b/ext/zlib/tests/gzclose_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function gzclose() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+// note that gzclose is an alias to fclose. parameter checking tests will be
+// the same as fclose
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+gzread($h, 20);
+var_dump(gzclose($h));
+
+//should fail.
+gzread($h, 20);
+
+$h = gzopen($f, 'r');
+gzread($h, 20);
+var_dump(fclose($h));
+
+//should fail.
+gzread($h, 20);
+
+
+?>
+===DONE===
+--EXPECTF--
+bool(true)
+
+Warning: gzread(): %d is not a valid stream resource in %s on line %d
+bool(true)
+
+Warning: gzread(): %d is not a valid stream resource in %s on line %d
+===DONE===
diff --git a/ext/zlib/tests/gzclose_error.phpt b/ext/zlib/tests/gzclose_error.phpt
new file mode 100644
index 0000000..ec4b6eb
--- /dev/null
+++ b/ext/zlib/tests/gzclose_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function gzclose() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+
+
+
+var_dump(gzclose( $h, $extra_arg ) );
+var_dump(gzclose());
+
+gzclose($h);
+
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzclose() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gzclose() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzeof_basic.phpt b/ext/zlib/tests/gzeof_basic.phpt
new file mode 100644
index 0000000..f5d2617
--- /dev/null
+++ b/ext/zlib/tests/gzeof_basic.phpt
@@ -0,0 +1,58 @@
+--TEST--
+Test function feof() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+// note that gzeof is an alias to gzeof. parameter checking tests will be
+// the same as gzeof
+
+$f = dirname(__FILE__)."/004.txt.gz";
+
+echo "-- test 1 --\n";
+$h = gzopen($f, 'r');
+var_dump(gzeof($h));
+gzpassthru($h);
+var_dump(gzeof($h));
+gzclose($h);
+
+echo "\n-- test 2 --\n";
+$h = gzopen($f, 'r');
+echo "reading 50 characters. eof should be false\n";
+gzread($h, 50)."\n";
+var_dump(gzeof($h));
+echo "reading 250 characters. eof should be true\n";
+gzread($h, 250)."\n";
+var_dump(gzeof($h));
+echo "reading 20 characters. eof should be true still\n";
+gzread($h, 20)."\n";
+var_dump(gzeof($h));
+gzclose($h);
+
+
+
+?>
+===DONE===
+--EXPECT--
+-- test 1 --
+bool(false)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+bool(true)
+
+-- test 2 --
+reading 50 characters. eof should be false
+bool(false)
+reading 250 characters. eof should be true
+bool(true)
+reading 20 characters. eof should be true still
+bool(true)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzeof_error.phpt b/ext/zlib/tests/gzeof_error.phpt
new file mode 100644
index 0000000..af0f7c1
--- /dev/null
+++ b/ext/zlib/tests/gzeof_error.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test function gzeof() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+var_dump(gzeof( $h, $extra_arg ) );
+var_dump(gzeof() );
+gzclose($h)
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzeof() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gzeof() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt
new file mode 100644
index 0000000..6d1e040
--- /dev/null
+++ b/ext/zlib/tests/gzeof_variation1.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function gzeof while writing.
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+$length = 10;
+gzwrite( $h, $str );
+var_dump(gzeof($h));
+gzwrite( $h, $str, $length);
+var_dump(gzeof($h));
+gzclose($h);
+var_dump(gzeof($h));
+unlink($filename);
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+
+Warning: gzeof(): %d is not a valid stream resource in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_basic.phpt b/ext/zlib/tests/gzfile_basic.phpt
new file mode 100644
index 0000000..1fceea5
--- /dev/null
+++ b/ext/zlib/tests/gzfile_basic.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function gzfile() reading a gzip relative file
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+$plaintxt = b<<<EOT
+hello world
+is a very common test
+for all languages
+EOT;
+$dirname = 'gzfile_temp';
+$filename = $dirname.'/plainfile.txt.gz';
+mkdir($dirname);
+$h = gzopen($filename, 'w');
+gzwrite($h, $plaintxt);
+gzclose($h);
+
+
+var_dump(gzfile( $filename ) );
+
+unlink($filename);
+rmdir($dirname);
+?>
+===DONE===
+--EXPECT--
+array(3) {
+ [0]=>
+ string(12) "hello world
+"
+ [1]=>
+ string(22) "is a very common test
+"
+ [2]=>
+ string(17) "for all languages"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_basic2.phpt b/ext/zlib/tests/gzfile_basic2.phpt
new file mode 100644
index 0000000..9f31eb0
--- /dev/null
+++ b/ext/zlib/tests/gzfile_basic2.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function gzfile() reading a plain relative file
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+$plaintxt = b<<<EOT
+hello world
+is a very common test
+for all languages
+EOT;
+$dirname = 'gzfile_temp';
+$filename = $dirname.'/plainfile.txt';
+mkdir($dirname);
+$h = fopen($filename, 'w');
+fwrite($h, $plaintxt);
+fclose($h);
+
+
+var_dump(gzfile( $filename ) );
+
+unlink($filename);
+rmdir($dirname);
+?>
+===DONE===
+--EXPECT--
+array(3) {
+ [0]=>
+ string(12) "hello world
+"
+ [1]=>
+ string(22) "is a very common test
+"
+ [2]=>
+ string(17) "for all languages"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_error.phpt b/ext/zlib/tests/gzfile_error.phpt
new file mode 100644
index 0000000..6089f3e
--- /dev/null
+++ b/ext/zlib/tests/gzfile_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function gzfile() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+$use_include_path = false;
+$extra_arg = 'nothing';
+
+var_dump(gzfile( $filename, $use_include_path, $extra_arg ) );
+
+var_dump(gzfile( ) );
+
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: gzfile() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation1.phpt b/ext/zlib/tests/gzfile_variation1.phpt
new file mode 100644
index 0000000..b573030
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation1.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with array values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation10.phpt b/ext/zlib/tests/gzfile_variation10.phpt
new file mode 100644
index 0000000..2a6d891
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation10.phpt
@@ -0,0 +1,119 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation11.phpt b/ext/zlib/tests/gzfile_variation11.phpt
new file mode 100644
index 0000000..02faa45
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation11.phpt
@@ -0,0 +1,129 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with float values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$variation = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation12.phpt b/ext/zlib/tests/gzfile_variation12.phpt
new file mode 100644
index 0000000..a8efc76
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation12.phpt
@@ -0,0 +1,108 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with int values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$variation = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation13.phpt b/ext/zlib/tests/gzfile_variation13.phpt
new file mode 100644
index 0000000..8014d7d
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation13.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with object values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = $filename = dirname(__FILE__)."/004.txt.gz";
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Error: 2 - gzfile() expects parameter 2 to be long, object given, %s(%d)
+NULL
+Error: 2 - gzfile() expects parameter 2 to be long, object given, %s(%d)
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation14.phpt b/ext/zlib/tests/gzfile_variation14.phpt
new file mode 100644
index 0000000..8eb183c
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation14.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with string values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = $filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation15.phpt b/ext/zlib/tests/gzfile_variation15.phpt
new file mode 100644
index 0000000..08360da
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation15.phpt
@@ -0,0 +1,109 @@
+--TEST--
+Test gzfile() function : variation: use include path (relative directories in path)
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+require_once('reading_include_path.inc');
+
+//define the files to go into these directories, create one in dir2
+set_include_path($newIncludePath);
+test_gzfile();
+restore_include_path();
+
+// remove the directory structure
+chdir($baseDir);
+rmdir($workingDir);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+chdir("..");
+rmdir($thisTestDir);
+
+function test_gzfile() {
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = gzopen($secondFile, "w");
+ gzwrite($h, "This is a file in dir2");
+ gzclose($h);
+
+ // should read dir2 file
+ var_dump(gzfile($filename, true));
+ echo "\n";
+
+ //create a file in dir1
+ $h = gzopen($firstFile, "w");
+ gzwrite($h, "This is a file in dir1");
+ gzclose($h);
+
+ //should now read dir1 file
+ var_dump(gzfile($filename, true));
+ echo "\n";
+
+ // create a file in working directory
+ $h = gzopen($filename, "w");
+ gzwrite($h, "This is a file in working dir");
+ gzclose($h);
+
+ //should still read dir1 file
+ var_dump(gzfile($filename, true));
+ echo "\n";
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working directory
+ var_dump(gzfile($filename, true));
+ echo "\n";
+
+ // create a file in the script directory
+ $h = gzopen($scriptFile, "w");
+ gzwrite($h, "This is a file in script dir");
+ gzclose($h);
+
+ //should read the file in script dir
+ var_dump(gzfile($filename, true));
+ echo "\n";
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+array(1) {
+ [0]=>
+ string(22) "This is a file in dir2"
+}
+
+array(1) {
+ [0]=>
+ string(22) "This is a file in dir1"
+}
+
+array(1) {
+ [0]=>
+ string(22) "This is a file in dir1"
+}
+
+array(1) {
+ [0]=>
+ string(29) "This is a file in working dir"
+}
+
+array(1) {
+ [0]=>
+ string(28) "This is a file in script dir"
+}
+
+===DONE===
+
diff --git a/ext/zlib/tests/gzfile_variation2.phpt b/ext/zlib/tests/gzfile_variation2.phpt
new file mode 100644
index 0000000..2f75c7f
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with boolean values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path =
+
+
+$variation = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation3.phpt b/ext/zlib/tests/gzfile_variation3.phpt
new file mode 100644
index 0000000..8a6f2ce
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: gzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation4.phpt b/ext/zlib/tests/gzfile_variation4.phpt
new file mode 100644
index 0000000..b3c8ac4
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation4.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with float values.
+--SKIPIF--
+<?php
+if (!extension_loaded(zlib)) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$variation = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Warning: gzfile(10.5): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(-10.5): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(123456789000): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(-123456789000): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(0.5): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/zlib/tests/gzfile_variation5.phpt b/ext/zlib/tests/gzfile_variation5.phpt
new file mode 100644
index 0000000..5e210b6
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation5.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with int values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$variation = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Warning: gzfile(0): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(1): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(12345): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(-2345): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation6.phpt b/ext/zlib/tests/gzfile_variation6.phpt
new file mode 100644
index 0000000..174524b
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation6.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with object values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+--EXPECTF--
+Error: 2 - gzfile(Class A object): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+Error: 2 - gzfile() expects parameter 1 to be string, object given, %s(%d)
+NULL \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation7.phpt b/ext/zlib/tests/gzfile_variation7.phpt
new file mode 100644
index 0000000..b441dd6
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation7.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test function gzfile() by substituting agument 1 with string values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(gzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile(string): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(string): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(sTrInG): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+Warning: gzfile(hello world): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/zlib/tests/gzfile_variation8.phpt b/ext/zlib/tests/gzfile_variation8.phpt
new file mode 100644
index 0000000..32d9693
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation8.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with array values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: gzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzfile_variation9.phpt b/ext/zlib/tests/gzfile_variation9.phpt
new file mode 100644
index 0000000..c2c24ae
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation9.phpt
@@ -0,0 +1,107 @@
+--TEST--
+Test function gzfile() by substituting agument 2 with boolean values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+$variation = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(gzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+array(6) {
+ [0]=>
+ string(36) "When you're taught through feelings
+"
+ [1]=>
+ string(26) "Destiny flying high above
+"
+ [2]=>
+ string(38) "all I know is that you can realize it
+"
+ [3]=>
+ string(18) "Destiny who cares
+"
+ [4]=>
+ string(19) "as it turns around
+"
+ [5]=>
+ string(39) "and I know that it descends down on me
+"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzgetc_basic.phpt b/ext/zlib/tests/gzgetc_basic.phpt
new file mode 100644
index 0000000..ca2e38c
--- /dev/null
+++ b/ext/zlib/tests/gzgetc_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test function gzgetc() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+// note that gzgets is an alias to fgets. parameter checking tests will be
+// the same as gzgets
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+$count = 0;
+while (gzeof($h) === false) {
+ $count++;
+ echo fgetc( $h );
+}
+
+echo "\ncharacters counted=$count\n";
+gzclose($h);
+
+?>
+===DONE===
+--EXPECT--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+
+characters counted=176
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzgetc_error.phpt b/ext/zlib/tests/gzgetc_error.phpt
new file mode 100644
index 0000000..cbeabe3
--- /dev/null
+++ b/ext/zlib/tests/gzgetc_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function gzgetc() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+var_dump(gzgetc( $h, $extra_arg ) );
+
+var_dump(gzgetc() );
+
+gzclose($h);
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzgetc() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gzgetc() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzgets_basic.phpt b/ext/zlib/tests/gzgets_basic.phpt
new file mode 100644
index 0000000..3ebc759
--- /dev/null
+++ b/ext/zlib/tests/gzgets_basic.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test function gzgets() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+// note that gzgets is an alias to fgets. parameter checking tests will be
+// the same as fgets
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$lengths = array(10, 14, 7, 99);
+foreach ($lengths as $length) {
+ var_dump(gzgets( $h, $length ) );
+}
+
+while (gzeof($h) === false) {
+ var_dump(gzgets($h));
+}
+gzclose($h);
+
+
+?>
+===DONE===
+--EXPECT--
+string(9) "When you'"
+string(13) "re taught thr"
+string(6) "ough f"
+string(8) "eelings
+"
+string(26) "Destiny flying high above
+"
+string(38) "all I know is that you can realize it
+"
+string(18) "Destiny who cares
+"
+string(19) "as it turns around
+"
+string(39) "and I know that it descends down on me
+"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzgets_error.phpt b/ext/zlib/tests/gzgets_error.phpt
new file mode 100644
index 0000000..fe224f1
--- /dev/null
+++ b/ext/zlib/tests/gzgets_error.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test function gzgets() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$length = 10;
+$extra_arg = 'nothing';
+var_dump(gzgets( $h, $length, $extra_arg ) );
+
+var_dump(gzgets());
+
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzgets() expects at most 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Warning: gzgets() expects at least 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzopen_basic.phpt b/ext/zlib/tests/gzopen_basic.phpt
new file mode 100644
index 0000000..e369773
--- /dev/null
+++ b/ext/zlib/tests/gzopen_basic.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test gzopen() function : basic functionality
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$filename = dirname(__FILE__)."/004.txt.gz";
+$mode = 'r';
+$use_include_path = false;
+
+// Calling gzopen() with all possible arguments
+$h = gzopen($filename, $mode, $use_include_path);
+gzpassthru($h);
+gzclose($h);
+
+// Calling gzopen() with mandatory arguments
+$h = gzopen($filename, $mode);
+gzpassthru($h);
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : basic functionality ***
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+===DONE===
diff --git a/ext/zlib/tests/gzopen_basic2.phpt b/ext/zlib/tests/gzopen_basic2.phpt
new file mode 100644
index 0000000..5cc02cd
--- /dev/null
+++ b/ext/zlib/tests/gzopen_basic2.phpt
@@ -0,0 +1,52 @@
+--TEST--
+Test gzopen() function : basic functionality for writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$filename = "temp.txt.gz";
+$modes = array('w', 'w+');
+$data = "This was the information that was written";
+
+foreach($modes as $mode) {
+ echo "testing mode -- $mode --\n";
+ $h = gzopen($filename, $mode);
+ if ($h !== false) {
+ gzwrite($h, $data);
+ gzclose($h);
+ $h = gzopen($filename, 'r');
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+ unlink($filename);
+ }
+ else {
+ var_dump($h);
+ }
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : basic functionality ***
+testing mode -- w --
+This was the information that was written
+testing mode -- w+ --
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+bool(false)
+===DONE===
diff --git a/ext/zlib/tests/gzopen_error.phpt b/ext/zlib/tests/gzopen_error.phpt
new file mode 100644
index 0000000..a71791f
--- /dev/null
+++ b/ext/zlib/tests/gzopen_error.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test gzopen() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : error conditions ***\n";
+
+
+//Test gzopen with one more than the expected number of arguments
+echo "\n-- Testing gzopen() function with more than expected no. of arguments --\n";
+$filename = 'string_val';
+$mode = 'string_val';
+$use_include_path = 10;
+$extra_arg = 10;
+var_dump( gzopen($filename, $mode, $use_include_path, $extra_arg) );
+
+// Testing gzopen with one less than the expected number of arguments
+echo "\n-- Testing gzopen() function with less than expected no. of arguments --\n";
+$filename = 'string_val';
+var_dump( gzopen($filename) );
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : error conditions ***
+
+-- Testing gzopen() function with more than expected no. of arguments --
+
+Warning: gzopen() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing gzopen() function with less than expected no. of arguments --
+
+Warning: gzopen() expects at least 2 parameters, 1 given in %s on line %d
+NULL
+===DONE===
diff --git a/ext/zlib/tests/gzopen_include_path.inc b/ext/zlib/tests/gzopen_include_path.inc
new file mode 100644
index 0000000..7d6723a
--- /dev/null
+++ b/ext/zlib/tests/gzopen_include_path.inc
@@ -0,0 +1,92 @@
+<?php
+$pwd = getcwd();
+$f = basename(__FILE__);
+$dir1 = $pwd."/".$f.".dir1";
+$dir2 = $pwd."/".$f.".dir2";
+$dir3 = $pwd."/".$f.".dir3";
+//invalid directory
+$dir4 = $pwd."/".$f.".dir4";
+$newdirs = array($dir1, $dir2, $dir3);
+
+$reldirs = array("dir1", "dir2", "dir3");
+
+function generate_next_rel_path() {
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return "dir4".$pathSep . $newIncludePath;
+}
+
+function generate_next_path() {
+ global $newdirs, $dir4;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $dir4.$pathSep . $newIncludePath;
+}
+
+
+function create_include_path() {
+
+ global $newdirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
+}
+
+function relative_include_path() {
+
+ global $reldirs;
+ //create the include directory structure
+ $pathSep = ":";
+ $newIncludePath = "";
+ if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+ }
+ foreach($reldirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= $newdir.$pathSep;
+ }
+ return $newIncludePath;
+}
+
+
+function teardown_include_path() {
+
+ global $newdirs;
+ // remove the directory structure
+ foreach($newdirs as $newdir) {
+ rmdir($newdir);
+ }
+}
+
+function teardown_relative_path() {
+
+ global $reldirs;
+ // remove the directory structure
+ foreach($reldirs as $newdir) {
+ rmdir($newdir);
+ }
+}
+?> \ No newline at end of file
diff --git a/ext/zlib/tests/gzopen_variation1.phpt b/ext/zlib/tests/gzopen_variation1.phpt
new file mode 100644
index 0000000..c5a47f4
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation1.phpt
@@ -0,0 +1,228 @@
+--TEST--
+Test gzopen() function : usage variation
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - zlib extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$mode = 'r';
+$use_include_path = false;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for filename
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gzopen($value, $mode, $use_include_path) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : usage variation ***
+
+--int 0--
+Error: 2 - gzopen(0): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - gzopen(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - gzopen(12345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - gzopen(-2345): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - gzopen(10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - gzopen(-10.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - gzopen(123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - gzopen(-123456789000): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - gzopen(0.5): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - gzopen() expects parameter 1 to be string, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - gzopen(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - gzopen(1): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - gzopen(Class A object): failed to open stream: No such file or directory, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - gzopen() expects parameter 1 to be string, object given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - gzopen(): Filename cannot be empty, %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - gzopen() expects parameter 1 to be string, resource given, %s(%d)
+NULL
+===DONE===
+
diff --git a/ext/zlib/tests/gzopen_variation2.phpt b/ext/zlib/tests/gzopen_variation2.phpt
new file mode 100644
index 0000000..4582935
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation2.phpt
@@ -0,0 +1,227 @@
+--TEST--
+Test gzopen() function : usage variation
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - zlib extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$filename = dirname(__FILE__)."/004.txt.gz";
+$use_include_path = false;
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // int data
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for mode
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ var_dump( gzopen($filename, $value, $use_include_path) );
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : usage variation ***
+
+--int 0--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--int 1--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--int 12345--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--int -12345--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--float 10.5--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--float -10.5--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--float 12.3456789000e10--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--float -12.3456789000e10--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--float .5--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--empty array--
+Error: 2 - gzopen() expects parameter 2 to be string, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - gzopen() expects parameter 2 to be string, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - gzopen() expects parameter 2 to be string, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - gzopen() expects parameter 2 to be string, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--lowercase null--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--lowercase true--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--lowercase false--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--uppercase TRUE--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--uppercase FALSE--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--empty string DQ--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--empty string SQ--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--instance of classWithToString--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--instance of classWithoutToString--
+Error: 2 - gzopen() expects parameter 2 to be string, object given, %s(%d)
+NULL
+
+--undefined var--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--unset var--
+Error: 2 - gzopen(%s/004.txt.gz): failed to open stream: %s, %s(%d)
+bool(false)
+
+--resource--
+Error: 2 - gzopen() expects parameter 2 to be string, resource given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/zlib/tests/gzopen_variation3.phpt b/ext/zlib/tests/gzopen_variation3.phpt
new file mode 100644
index 0000000..59e45a8
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation3.phpt
@@ -0,0 +1,218 @@
+--TEST--
+Test gzopen() function : usage variation
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - zlib extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : usage variation ***\n";
+
+// Define error handler
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+// Initialise function arguments not being substituted (if any)
+$filename = dirname(__FILE__)."/004.txt.gz";
+$mode = 'r';
+
+//get an unset variable
+$unset_var = 10;
+unset ($unset_var);
+
+// define some classes
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+// heredoc string
+$heredoc = <<<EOT
+hello world
+EOT;
+
+// get a resource variable
+$fp = fopen(__FILE__, "r");
+
+// add arrays
+$index_array = array (1, 2, 3);
+$assoc_array = array ('one' => 1, 'two' => 2);
+
+//array of values to iterate over
+$inputs = array(
+
+ // float data
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+
+ // array data
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+
+ // null data
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+
+ // boolean data
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+
+ // empty data
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+
+ // string data
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc,
+
+ // object data
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+
+ // undefined data
+ 'undefined var' => @$undefined_var,
+
+ // unset data
+ 'unset var' => @$unset_var,
+
+ // resource variable
+ 'resource' => $fp
+);
+
+// loop through each element of the array for use_include_path
+
+foreach($inputs as $key =>$value) {
+ echo "\n--$key--\n";
+ $res = gzopen($filename, $mode, $value);
+ var_dump($res);
+ if ($res === true) {
+ gzclose($res);
+ }
+};
+
+fclose($fp);
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : usage variation ***
+
+--float 10.5--
+resource(%d) of type (stream)
+
+--float -10.5--
+resource(%d) of type (stream)
+
+--float 12.3456789000e10--
+resource(%d) of type (stream)
+
+--float -12.3456789000e10--
+resource(%d) of type (stream)
+
+--float .5--
+resource(%d) of type (stream)
+
+--empty array--
+Error: 2 - gzopen() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--int indexed array--
+Error: 2 - gzopen() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--associative array--
+Error: 2 - gzopen() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--nested arrays--
+Error: 2 - gzopen() expects parameter 3 to be long, array given, %s(%d)
+NULL
+
+--uppercase NULL--
+resource(%d) of type (stream)
+
+--lowercase null--
+resource(%d) of type (stream)
+
+--lowercase true--
+resource(%d) of type (stream)
+
+--lowercase false--
+resource(%d) of type (stream)
+
+--uppercase TRUE--
+resource(%d) of type (stream)
+
+--uppercase FALSE--
+resource(%d) of type (stream)
+
+--empty string DQ--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--empty string SQ--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string DQ--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--string SQ--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--mixed case string--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--heredoc--
+Error: 2 - gzopen() expects parameter 3 to be long, string given, %s(%d)
+NULL
+
+--instance of classWithToString--
+Error: 2 - gzopen() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--instance of classWithoutToString--
+Error: 2 - gzopen() expects parameter 3 to be long, object given, %s(%d)
+NULL
+
+--undefined var--
+resource(%d) of type (stream)
+
+--unset var--
+resource(%d) of type (stream)
+
+--resource--
+Error: 2 - gzopen() expects parameter 3 to be long, resource given, %s(%d)
+NULL
+===DONE===
diff --git a/ext/zlib/tests/gzopen_variation4.phpt b/ext/zlib/tests/gzopen_variation4.phpt
new file mode 100644
index 0000000..f829acf0
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation4.phpt
@@ -0,0 +1,161 @@
+--TEST--
+Test gzopen() function : variation: use include path (relative directories in path)
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : usage variation ***\n";
+
+require_once('reading_include_path.inc');
+
+//define the files to go into these directories, create one in dir2
+echo "\n--- testing include path ---\n";
+set_include_path($newIncludePath);
+$modes = array("r", "r+", "rt");
+foreach($modes as $mode) {
+ test_gzopen($mode);
+}
+restore_include_path();
+
+// remove the directory structure
+chdir($baseDir);
+rmdir($workingDir);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+chdir("..");
+rmdir($thisTestDir);
+
+function test_gzopen($mode) {
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = gzopen($secondFile, "w");
+ gzwrite($h, "This is a file in dir2");
+ gzclose($h);
+
+ echo "\n** testing with mode=$mode **\n";
+ // should read dir2 file
+ $h = gzopen($filename, $mode, true);
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+
+ //create a file in dir1
+ $h = gzopen($firstFile, "w");
+ gzwrite($h, "This is a file in dir1");
+ gzclose($h);
+
+ //should now read dir1 file
+ $h = gzopen($filename, $mode, true);
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+
+ // create a file in working directory
+ $h = gzopen($filename, "w");
+ gzwrite($h, "This is a file in working dir");
+ gzclose($h);
+
+ //should still read dir1 file
+ $h = gzopen($filename, $mode, true);
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working dir
+ $h = gzopen($filename, $mode, true);
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+
+ // create a file in the script directory
+ $h = gzopen($scriptFile, "w");
+ gzwrite($h, "This is a file in script dir");
+ gzclose($h);
+
+ //should read the file in script dir
+ $h = gzopen($filename, $mode, true);
+ gzpassthru($h);
+ gzclose($h);
+ echo "\n";
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
+
+}
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : usage variation ***
+
+--- testing include path ---
+
+** testing with mode=r **
+This is a file in dir2
+This is a file in dir1
+This is a file in dir1
+This is a file in working dir
+This is a file in script dir
+
+** testing with mode=r+ **
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+
+Warning: gzpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+
+Warning: gzclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+
+Warning: gzpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+
+Warning: gzclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+
+Warning: gzpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+
+Warning: gzclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+
+Warning: gzpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+
+Warning: gzclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+
+Warning: gzpassthru() expects parameter 1 to be resource, boolean given in %s on line %d
+
+Warning: gzclose() expects parameter 1 to be resource, boolean given in %s on line %d
+
+
+** testing with mode=rt **
+This is a file in dir2
+This is a file in dir1
+This is a file in dir1
+This is a file in working dir
+This is a file in script dir
+===DONE===
+
diff --git a/ext/zlib/tests/gzopen_variation5.phpt b/ext/zlib/tests/gzopen_variation5.phpt
new file mode 100644
index 0000000..de505f7
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation5.phpt
@@ -0,0 +1,71 @@
+--TEST--
+Test gzopen() function : variation: use include path and stream context create a file, relative path
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+require_once('gzopen_include_path.inc');
+
+echo "*** Testing gzopen() : variation ***\n";
+$thisTestDir = "gzopenVariation5.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+$newpath = relative_include_path();
+set_include_path($newpath);
+runtest();
+$newpath = generate_next_rel_path();
+set_include_path($newpath);
+runtest();
+
+teardown_relative_path();
+restore_include_path();
+chdir("..");
+rmdir($thisTestDir);
+
+function runtest() {
+ $tmpfile = 'gzopen_variation5.tmp';
+ $h = gzopen($tmpfile, "w", true);
+ fwrite($h, "This is the test file");
+ fclose($h);
+
+
+ $h = @gzopen($tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in working dir\n";
+ }
+ else {
+ echo "created in working dir\n";
+ gzclose($h);
+ unlink($tmpfile);
+ }
+
+ $h = @gzopen('dir1/'.$tmpfile, "r");
+ if ($h === false) {
+ echo "Not created in dir1\n";
+ }
+ else {
+ echo "created in dir1\n";
+ gzclose($h);
+ unlink('dir1/'.$tmpfile);
+ }
+}
+?>
+===DONE===
+--EXPECT--
+*** Testing gzopen() : variation ***
+created in working dir
+Not created in dir1
+created in working dir
+Not created in dir1
+===DONE===
diff --git a/ext/zlib/tests/gzopen_variation6.phpt b/ext/zlib/tests/gzopen_variation6.phpt
new file mode 100644
index 0000000..9fe3f24
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation6.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test gzopen() function : variation: relative/absolute file
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : resource gzopen(string filename, string mode [, int use_include_path])
+ * Description: Open a .gz-file and return a .gz-file pointer
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzopen() : variation ***\n";
+$absfile = __FILE__.'.tmp';
+$relfile = "gzopen_variation6.tmp";
+
+$h = gzopen($absfile, "w");
+gzwrite($h, "This is an absolute file");
+gzclose($h);
+
+$h = gzopen($relfile, "w");
+gzwrite($h, "This is a relative file");
+gzclose($h);
+
+$h = gzopen($absfile, "r");
+gzpassthru($h);
+fclose($h);
+echo "\n";
+
+$h = gzopen($relfile, "r");
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+
+unlink($absfile);
+unlink($relfile);
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : variation ***
+This is an absolute file
+This is a relative file
+===DONE===
diff --git a/ext/zlib/tests/gzopen_variation7.phpt b/ext/zlib/tests/gzopen_variation7.phpt
new file mode 100644
index 0000000..92642b0
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation7.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function gzopen() by calling it twice on the same file and not closing one of them at the end of the script
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h1 = gzopen($f, 'r');
+$h2 = gzopen($f, 'r');
+
+var_dump(gzread($h1, 30));
+var_dump(gzread($h2, 10));
+var_dump(gzread($h1, 15));
+gzclose($h1);
+var_dump(gzread($h2, 50));
+// deliberately do not close $h2
+?>
+===DONE===
+--EXPECT--
+string(30) "When you're taught through fee"
+string(10) "When you'r"
+string(15) "lings
+Destiny f"
+string(50) "e taught through feelings
+Destiny flying high abov"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzpassthru_basic.phpt b/ext/zlib/tests/gzpassthru_basic.phpt
new file mode 100644
index 0000000..931c2b2
--- /dev/null
+++ b/ext/zlib/tests/gzpassthru_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function gzpassthru() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+// note that gzpassthru is an alias to fpassthru. parameter checking tests will be
+// the same as fpassthru
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+var_dump(gzpassthru($h));
+var_dump(gzpassthru($h));
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+int(0)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzpassthru_error.phpt b/ext/zlib/tests/gzpassthru_error.phpt
new file mode 100644
index 0000000..18d72ef
--- /dev/null
+++ b/ext/zlib/tests/gzpassthru_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function gzpassthru() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+var_dump(gzpassthru( $h, $extra_arg ) );
+var_dump(gzpassthru() );
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzpassthru() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gzpassthru() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzputs_basic.phpt b/ext/zlib/tests/gzputs_basic.phpt
new file mode 100644
index 0000000..7566e74
--- /dev/null
+++ b/ext/zlib/tests/gzputs_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function gzputs() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+$length = 10;
+var_dump(gzputs( $h, $str ) );
+var_dump(gzputs( $h, $str, $length ) );
+gzclose($h);
+
+$h = gzopen($filename, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+int(34)
+int(10)
+Here is the string to be written. Here is th
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzread_basic.phpt b/ext/zlib/tests/gzread_basic.phpt
new file mode 100644
index 0000000..ecb62a8
--- /dev/null
+++ b/ext/zlib/tests/gzread_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test function gzread() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+// note that gzread is an alias to fread. parameter checking tests will be
+// the same as fread
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$lengths = array(10, 14, 7, 99, 2000);
+
+foreach ($lengths as $length) {
+ var_dump(gzread( $h, $length ) );
+}
+gzclose($h);
+
+?>
+===DONE===
+--EXPECT--
+string(10) "When you'r"
+string(14) "e taught throu"
+string(7) "gh feel"
+string(99) "ings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns "
+string(46) "around
+and I know that it descends down on me
+"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzread_error.phpt b/ext/zlib/tests/gzread_error.phpt
new file mode 100644
index 0000000..989e832
--- /dev/null
+++ b/ext/zlib/tests/gzread_error.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function gzread() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$length = 10;
+$extra_arg = 'nothing';
+
+var_dump(gzread( $h, $length, $extra_arg ) );
+
+var_dump(gzread());
+
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzread() expects exactly 2 parameters, 3 given in %s on line %d
+bool(false)
+
+Warning: gzread() expects exactly 2 parameters, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzread_error2.phpt b/ext/zlib/tests/gzread_error2.phpt
new file mode 100644
index 0000000..fae6356
--- /dev/null
+++ b/ext/zlib/tests/gzread_error2.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function gzread() by calling it invalid lengths
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+var_dump(gzread($h, 10));
+var_dump(gzread($h, 0));
+var_dump(gzread($h, 5));
+var_dump(gzread($h, -1));
+var_dump(gzread($h, 8));
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+string(10) "When you'r"
+
+Warning: gzread(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+string(5) "e tau"
+
+Warning: gzread(): Length parameter must be greater than 0 in %s on line %d
+bool(false)
+string(8) "ght thro"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzread_variation1.phpt b/ext/zlib/tests/gzread_variation1.phpt
new file mode 100644
index 0000000..1f50d77
--- /dev/null
+++ b/ext/zlib/tests/gzread_variation1.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function gzread() by calling it while file open for writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = "temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+var_dump(gzread($h, 100));
+gzwrite( $h, $str);
+var_dump(gzread($h, 100));
+gzrewind($h);
+var_dump(gzread($h, 100));
+gzclose($h);
+
+$h = gzopen($filename, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+string(0) ""
+string(0) ""
+string(0) ""
+Here is the string to be written.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzrewind_basic.phpt b/ext/zlib/tests/gzrewind_basic.phpt
new file mode 100644
index 0000000..959f0fc
--- /dev/null
+++ b/ext/zlib/tests/gzrewind_basic.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test function gzrewind() by calling it with its expected arguments when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+echo "test rewind before doing anything\n";
+var_dump(gzrewind($h));
+var_dump(gztell($h));
+echo "\nfirst 30 characters=".gzread($h, 30)."\n";
+var_dump(gztell($h));
+gzrewind($h);
+var_dump(gztell($h));
+echo "first 10 characters=".gzread($h, 10)."\n";
+gzrewind($h);
+echo "first 20 characters=".gzread($h, 20)."\n";
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+test rewind before doing anything
+bool(true)
+int(0)
+
+first 30 characters=When you're taught through fee
+int(30)
+int(0)
+first 10 characters=When you'r
+first 20 characters=When you're taught t
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzrewind_basic2.phpt b/ext/zlib/tests/gzrewind_basic2.phpt
new file mode 100644
index 0000000..f51751c
--- /dev/null
+++ b/ext/zlib/tests/gzrewind_basic2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function gzrewind() by calling it with its expected arguments when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+// read to the end of the file
+echo "read to the end of the file, then rewind\n";
+gzread($h, 10000);
+var_dump(gzeof($h));
+var_dump(gztell($h));
+gzrewind($h);
+var_dump(gzeof($h));
+var_dump(gztell($h));
+echo "first 20 characters=".gzread($h,20)."\n";
+
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+read to the end of the file, then rewind
+bool(true)
+int(176)
+bool(false)
+int(0)
+first 20 characters=When you're taught t
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzrewind_error.phpt b/ext/zlib/tests/gzrewind_error.phpt
new file mode 100644
index 0000000..3a1e4c9
--- /dev/null
+++ b/ext/zlib/tests/gzrewind_error.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function gzrewind() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+var_dump(gzrewind( $h, $extra_arg ) );
+var_dump(gzrewind());
+gzclose($h);
+
+?>
+===DONE===
+--EXPECTF--
+Warning: gzrewind() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gzrewind() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzrewind_variation1.phpt b/ext/zlib/tests/gzrewind_variation1.phpt
new file mode 100644
index 0000000..8201862
--- /dev/null
+++ b/ext/zlib/tests/gzrewind_variation1.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Test function gzrewind() by calling it with its expected arguments when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = "temp2.txt.gz";
+$h = gzopen($f, 'w');
+gzwrite($h, b'The first string.');
+var_dump(gzrewind($h));
+gzwrite($h, b'The second string.');
+gzclose($h);
+
+$h = gzopen($f, 'r');
+gzpassthru($h);
+gzclose($h);
+unlink($f);
+echo "\n";
+?>
+===DONE===
+--EXPECT--
+bool(false)
+The first string.The second string.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_basic.phpt b/ext/zlib/tests/gzseek_basic.phpt
new file mode 100644
index 0000000..d641bad
--- /dev/null
+++ b/ext/zlib/tests/gzseek_basic.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function gzseek() by calling it with its expected arguments when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+echo "move to the 50th byte\n";
+var_dump(gzseek( $h, 50 ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove forward to the 100th byte\n";
+var_dump(gzseek( $h, 100 ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove backward to the 20th byte\n";
+var_dump(gzseek( $h, 20 ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+move to the 50th byte
+int(0)
+tell=50
+string(10) " high abov"
+
+move forward to the 100th byte
+int(0)
+tell=100
+string(10) "Destiny wh"
+
+move backward to the 20th byte
+int(0)
+tell=20
+string(10) "hrough fee"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_basic2.phpt b/ext/zlib/tests/gzseek_basic2.phpt
new file mode 100644
index 0000000..a815b8f
--- /dev/null
+++ b/ext/zlib/tests/gzseek_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function gzseek() by calling it with its expected arguments when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$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);
+echo "tell=".gztell($h)."\n";
+gzwrite($h, $str2);
+echo "tell=".gztell($h)."\n";
+gzclose($h);
+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";
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+tell=23
+tell=43
+tell=67
+
+reading the output file
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_error.phpt b/ext/zlib/tests/gzseek_error.phpt
new file mode 100644
index 0000000..ab6c965
--- /dev/null
+++ b/ext/zlib/tests/gzseek_error.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function gzseek() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$offset = 1;
+$whence = SEEK_SET;
+$extra_arg = 'nothing';
+
+var_dump(gzseek( $h, $offset, $whence, $extra_arg ) );
+var_dump(gzseek($h));
+var_dump(gzseek());
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzseek() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: gzseek() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: gzseek() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_variation1.phpt b/ext/zlib/tests/gzseek_variation1.phpt
new file mode 100644
index 0000000..301b57d
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function gzseek() by seeking forward in write mode
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = "temp3.txt.gz";
+$h = gzopen($f, 'w');
+$str1 = "This is the first line.";
+$str2 = "This is the second line.";
+gzwrite($h, $str1);
+
+//seek forwards 20 bytes.
+gzseek($h, strlen($str1) + 20);
+gzwrite($h, $str2);
+gzclose($h);
+$h = gzopen($f, 'r');
+echo gzread($h, strlen($str1))."\n";
+echo var_dump(bin2hex(gzread($h, 20)));
+echo gzread($h, strlen($str2))."\n";
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_variation2.phpt b/ext/zlib/tests/gzseek_variation2.phpt
new file mode 100644
index 0000000..e70d6dd
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation2.phpt
@@ -0,0 +1,49 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_SET when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+echo "move to the 50th byte\n";
+var_dump(gzseek( $h, 50, SEEK_SET ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove forward to the 100th byte\n";
+var_dump(gzseek( $h, 100, SEEK_SET ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove backward to the 20th byte\n";
+var_dump(gzseek( $h, 20, SEEK_SET ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+move to the 50th byte
+int(0)
+tell=50
+string(10) " high abov"
+
+move forward to the 100th byte
+int(0)
+tell=100
+string(10) "Destiny wh"
+
+move backward to the 20th byte
+int(0)
+tell=20
+string(10) "hrough fee"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_variation3.phpt b/ext/zlib/tests/gzseek_variation3.phpt
new file mode 100644
index 0000000..dee7c13
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_CUR when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+
+echo "move to the 50th byte\n";
+var_dump(gzseek( $h, 50, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove forward to the 94th byte\n";
+var_dump(gzseek( $h, 34, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+
+echo "\nmove backward to the 77th byte\n";
+var_dump(gzseek( $h, -27, SEEK_CUR ) );
+echo "tell=".gztell($h)."\n";
+//read the next 10
+var_dump(gzread($h, 10));
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+move to the 50th byte
+int(0)
+tell=50
+string(10) " high abov"
+
+move forward to the 94th byte
+int(0)
+tell=94
+string(10) "ze it
+Dest"
+
+move backward to the 77th byte
+int(0)
+tell=77
+string(10) "hat you ca"
+===DONE=== \ No newline at end of file
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--
+Test function gzseek() by calling it with SEEK_SET when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$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";
+gzclose($h);
+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";
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+tell=23
+tell=43
+tell=67
+
+reading the output file
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_variation5.phpt b/ext/zlib/tests/gzseek_variation5.phpt
new file mode 100644
index 0000000..0167e20
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation5.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_CUR when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$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, 20, SEEK_CUR);
+echo "tell=".gztell($h)."\n";
+gzwrite($h, $str2);
+echo "tell=".gztell($h)."\n";
+gzclose($h);
+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";
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+tell=23
+tell=43
+tell=67
+
+reading the output file
+This is the first line.
+string(40) "0000000000000000000000000000000000000000"
+This is the second line.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gztell_basic.phpt b/ext/zlib/tests/gztell_basic.phpt
new file mode 100644
index 0000000..b6baf42
--- /dev/null
+++ b/ext/zlib/tests/gztell_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function gztell() by calling it with its expected arguments when reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$intervals = array(7, 22, 54, 17, 27, 15, 1000);
+// tell should be 7, 29, 83, 100, 127, 142, 176 (176 is length of uncompressed file)
+
+var_dump(gztell($h));
+foreach ($intervals as $interval) {
+ gzread($h, $interval);
+ var_dump(gztell($h));
+}
+
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+int(0)
+int(7)
+int(29)
+int(83)
+int(100)
+int(127)
+int(142)
+int(176)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gztell_basic2.phpt b/ext/zlib/tests/gztell_basic2.phpt
new file mode 100644
index 0000000..a8574ee
--- /dev/null
+++ b/ext/zlib/tests/gztell_basic2.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test function gztell() by calling it with its expected arguments when writing
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = "temp2.txt.gz";
+$h = gzopen($f, 'w');
+$sizes = array(7, 22, 54, 17, 27, 15, 1000);
+// tell should be 7, 29, 83, 100, 127, 142, 1142
+
+var_dump(gztell($h));
+foreach ($sizes as $size) {
+ echo "bytes written=".gzwrite($h, str_repeat(b'1', $size))."\n";;
+ echo "tell=".gztell($h)."\n";
+}
+
+gzclose($h);
+unlink($f);
+?>
+===DONE===
+--EXPECT--
+int(0)
+bytes written=7
+tell=7
+bytes written=22
+tell=29
+bytes written=54
+tell=83
+bytes written=17
+tell=100
+bytes written=27
+tell=127
+bytes written=15
+tell=142
+bytes written=1000
+tell=1142
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gztell_error.phpt b/ext/zlib/tests/gztell_error.phpt
new file mode 100644
index 0000000..e207c59
--- /dev/null
+++ b/ext/zlib/tests/gztell_error.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test function gztell() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f, 'r');
+$extra_arg = 'nothing';
+var_dump(gztell( $h, $extra_arg ) );
+var_dump(gztell());
+gzclose($h);
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gztell() expects exactly 1 parameter, 2 given in %s on line %d
+bool(false)
+
+Warning: gztell() expects exactly 1 parameter, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzwrite_basic.phpt b/ext/zlib/tests/gzwrite_basic.phpt
new file mode 100644
index 0000000..0d75216
--- /dev/null
+++ b/ext/zlib/tests/gzwrite_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test function gzwrite() by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = "temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+$length = 10;
+var_dump(gzwrite( $h, $str ) );
+var_dump(gzwrite( $h, $str, $length ) );
+gzclose($h);
+
+$h = gzopen($filename, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+int(34)
+int(10)
+Here is the string to be written. Here is th
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzwrite_error.phpt b/ext/zlib/tests/gzwrite_error.phpt
new file mode 100644
index 0000000..b84a1db
--- /dev/null
+++ b/ext/zlib/tests/gzwrite_error.phpt
@@ -0,0 +1,35 @@
+--TEST--
+Test function gzwrite() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$filename = "temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+$length = 10;
+$extra_arg = 'nothing';
+var_dump(gzwrite($h, $str, $length, $extra_arg));
+var_dump(gzwrite($h));
+var_dump(gzwrite());
+
+gzclose($h);
+unlink($filename);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: gzwrite() expects at most 3 parameters, 4 given in %s on line %d
+bool(false)
+
+Warning: gzwrite() expects at least 2 parameters, 1 given in %s on line %d
+bool(false)
+
+Warning: gzwrite() expects at least 2 parameters, 0 given in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzwrite_error2.phpt b/ext/zlib/tests/gzwrite_error2.phpt
new file mode 100644
index 0000000..6912750
--- /dev/null
+++ b/ext/zlib/tests/gzwrite_error2.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test function gzwrite() by calling it invalid lengths
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = "temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written. ";
+var_dump(gzwrite( $h, $str, 0 ) );
+var_dump(gzwrite( $h, $str, -1 ) );
+gzclose($h);
+
+$h = gzopen($filename, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+int(0)
+int(0)
+
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzwrite_variation1.phpt b/ext/zlib/tests/gzwrite_variation1.phpt
new file mode 100644
index 0000000..bd3778e
--- /dev/null
+++ b/ext/zlib/tests/gzwrite_variation1.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Test function gzwrite() by calling it when file is opened for reading
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($filename, 'r');
+$str = "Here is the string to be written. ";
+$length = 10;
+var_dump(gzwrite( $h, $str ) );
+var_dump(gzread($h, 10));
+var_dump(gzwrite( $h, $str, $length ) );
+gzclose($h);
+
+?>
+===DONE===
+--EXPECT--
+int(0)
+string(10) "When you'r"
+int(0)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_basic.phpt b/ext/zlib/tests/readgzfile_basic.phpt
new file mode 100644
index 0000000..2d180c1
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_basic.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function readgzfile() reading a gzip relative file
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+$plaintxt = b<<<EOT
+hello world
+is a very common test
+for all languages
+
+EOT;
+$dirname = 'readgzfile_temp';
+$filename = $dirname.'/plainfile.txt.gz';
+mkdir($dirname);
+$h = gzopen($filename, 'w');
+gzwrite($h, $plaintxt);
+gzclose($h);
+
+
+var_dump(readgzfile( $filename ) );
+
+unlink($filename);
+rmdir($dirname);
+?>
+===DONE===
+--EXPECT--
+hello world
+is a very common test
+for all languages
+int(52)
+===DONE===
diff --git a/ext/zlib/tests/readgzfile_basic2.phpt b/ext/zlib/tests/readgzfile_basic2.phpt
new file mode 100644
index 0000000..99d216a
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_basic2.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function readgzfile() reading a plain relative file
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+$plaintxt = b<<<EOT
+hello world
+is a very common test
+for all languages
+
+EOT;
+$dirname = 'readgzfile_temp';
+$filename = $dirname.'/plainfile.txt';
+mkdir($dirname);
+$h = fopen($filename, 'w');
+fwrite($h, $plaintxt);
+fclose($h);
+
+
+var_dump(readgzfile( $filename ) );
+
+unlink($filename);
+rmdir($dirname);
+?>
+===DONE===
+--EXPECT--
+hello world
+is a very common test
+for all languages
+int(52)
+===DONE===
diff --git a/ext/zlib/tests/readgzfile_error.phpt b/ext/zlib/tests/readgzfile_error.phpt
new file mode 100644
index 0000000..4ec76d0
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_error.phpt
@@ -0,0 +1,29 @@
+--TEST--
+Test function readgzfile() by calling it more than or less than its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+$use_include_path = false;
+$extra_arg = 'nothing';
+
+var_dump(readgzfile( $filename, $use_include_path, $extra_arg ) );
+
+var_dump(readgzfile( ) );
+
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: readgzfile() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+Warning: readgzfile() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation1.phpt b/ext/zlib/tests/readgzfile_variation1.phpt
new file mode 100644
index 0000000..e31824c
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation1.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with array values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 1 to be string, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation10.phpt b/ext/zlib/tests/readgzfile_variation10.phpt
new file mode 100644
index 0000000..29249a1f
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation10.phpt
@@ -0,0 +1,67 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation11.phpt b/ext/zlib/tests/readgzfile_variation11.phpt
new file mode 100644
index 0000000..4023211
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation11.phpt
@@ -0,0 +1,64 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with float values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$variation = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation12.phpt b/ext/zlib/tests/readgzfile_variation12.phpt
new file mode 100644
index 0000000..8c291a4
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation12.phpt
@@ -0,0 +1,56 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with int values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$variation = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation13.phpt b/ext/zlib/tests/readgzfile_variation13.phpt
new file mode 100644
index 0000000..117860e
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation13.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with object values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = $filename = dirname(__FILE__)."/004.txt.gz";
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Error: 2 - readgzfile() expects parameter 2 to be long, object given, %s(%d)
+NULL
+Error: 2 - readgzfile() expects parameter 2 to be long, object given, %s(%d)
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation14.phpt b/ext/zlib/tests/readgzfile_variation14.phpt
new file mode 100644
index 0000000..165bf59
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation14.phpt
@@ -0,0 +1,44 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with string values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = $filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation15.phpt b/ext/zlib/tests/readgzfile_variation15.phpt
new file mode 100644
index 0000000..36ff6ff
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation15.phpt
@@ -0,0 +1,94 @@
+--TEST--
+Test readgzfile() function : variation: use include path (relative directories in path)
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+require_once('reading_include_path.inc');
+
+//define the files to go into these directories, create one in dir2
+set_include_path($newIncludePath);
+test_readgzfile();
+restore_include_path();
+
+// remove the directory structure
+chdir($baseDir);
+rmdir($workingDir);
+foreach($newdirs as $newdir) {
+ rmdir($newdir);
+}
+
+chdir("..");
+rmdir($thisTestDir);
+
+function test_readgzfile() {
+ global $scriptFile, $secondFile, $firstFile, $filename;
+
+ // create a file in the middle directory
+ $h = gzopen($secondFile, "w");
+ gzwrite($h, "This is a file in dir2");
+ gzclose($h);
+
+ // should read dir2 file
+ echo "file content:";
+ readgzfile($filename, true);
+ echo "\n";
+
+ //create a file in dir1
+ $h = gzopen($firstFile, "w");
+ gzwrite($h, "This is a file in dir1");
+ gzclose($h);
+
+ //should now read dir1 file
+ echo "file content:";
+ readgzfile($filename, true);
+ echo "\n";
+
+ // create a file in working directory
+ $h = gzopen($filename, "w");
+ gzwrite($h, "This is a file in working dir");
+ gzclose($h);
+
+ //should still read dir1 file
+ echo "file content:";
+ readgzfile($filename, true);
+ echo "\n";
+
+ unlink($firstFile);
+ unlink($secondFile);
+
+ //should read the file in working dir
+ echo "file content:";
+ readgzfile($filename, true);
+ echo "\n";
+
+ // create a file in the script directory
+ $h = gzopen($scriptFile, "w");
+ gzwrite($h, "This is a file in script dir");
+ gzclose($h);
+
+ //should read the file in script dir
+ echo "file content:";
+ readgzfile($filename, true);
+ echo "\n";
+
+ //cleanup
+ unlink($filename);
+ unlink($scriptFile);
+
+}
+
+?>
+===DONE===
+--EXPECT--
+file content:This is a file in dir2
+file content:This is a file in dir1
+file content:This is a file in dir1
+file content:This is a file in working dir
+file content:This is a file in script dir
+===DONE===
+
diff --git a/ext/zlib/tests/readgzfile_variation2.phpt b/ext/zlib/tests/readgzfile_variation2.phpt
new file mode 100644
index 0000000..367cc40
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation2.phpt
@@ -0,0 +1,40 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with boolean values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path =
+
+
+$variation = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation3.phpt b/ext/zlib/tests/readgzfile_variation3.phpt
new file mode 100644
index 0000000..6645d67
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation3.phpt
@@ -0,0 +1,50 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with emptyUnsetUndefNull values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$unset_var = 10;
+unset($unset_var);
+
+$variation = array(
+ 'unset var' => @$unset_var,
+ 'undefined var' => @$undefined_var,
+ 'empty string DQ' => "",
+ 'empty string SQ' => '',
+ 'uppercase NULL' => NULL,
+ 'lowercase null' => null,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+
+Warning: readgzfile(): Filename cannot be empty in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation4.phpt b/ext/zlib/tests/readgzfile_variation4.phpt
new file mode 100644
index 0000000..cbc561c
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation4.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with float values.
+--SKIPIF--
+<?php
+if (!extension_loaded(zlib)) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$variation = array(
+ 'float 10.5' => 10.5,
+ 'float -10.5' => -10.5,
+ 'float 12.3456789000e10' => 12.3456789000e10,
+ 'float -12.3456789000e10' => -12.3456789000e10,
+ 'float .5' => .5,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation5.phpt b/ext/zlib/tests/readgzfile_variation5.phpt
new file mode 100644
index 0000000..dde0dab
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation5.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with int values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$variation = array (
+ 'int 0' => 0,
+ 'int 1' => 1,
+ 'int 12345' => 12345,
+ 'int -12345' => -2345,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation6.phpt b/ext/zlib/tests/readgzfile_variation6.phpt
new file mode 100644
index 0000000..1beeca7
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation6.phpt
@@ -0,0 +1,48 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with object values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
+ if (error_reporting() != 0) {
+ // report non-silenced errors
+ echo "Error: $err_no - $err_msg, $filename($linenum)\n";
+ }
+}
+set_error_handler('test_error_handler');
+
+
+
+class classWithToString
+{
+ public function __toString() {
+ return "Class A object";
+ }
+}
+
+class classWithoutToString
+{
+}
+
+$variation = array(
+ 'instance of classWithToString' => new classWithToString(),
+ 'instance of classWithoutToString' => new classWithoutToString(),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+--EXPECTF--
+bool(false)
+Error: 2 - readgzfile() expects parameter 1 to be string, object given, %s(%d)
+NULL \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation7.phpt b/ext/zlib/tests/readgzfile_variation7.phpt
new file mode 100644
index 0000000..df244d3
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation7.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test function readgzfile() by substituting agument 1 with string values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$use_include_path = false;
+
+
+$heredoc = <<<EOT
+hello world
+EOT;
+
+$variation_array = array(
+ 'string DQ' => "string",
+ 'string SQ' => 'string',
+ 'mixed case string' => "sTrInG",
+ 'heredoc' => $heredoc
+ );
+
+
+foreach ( $variation_array as $var ) {
+ var_dump(readgzfile( $var , $use_include_path ) );
+}
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+bool(false)
+bool(false)
+===DONE===
diff --git a/ext/zlib/tests/readgzfile_variation8.phpt b/ext/zlib/tests/readgzfile_variation8.phpt
new file mode 100644
index 0000000..2e15528
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation8.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with array values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+
+$index_array = array(1, 2, 3);
+$assoc_array = array(1 => 'one', 2 => 'two');
+
+$variation = array(
+ 'empty array' => array(),
+ 'int indexed array' => $index_array,
+ 'associative array' => $assoc_array,
+ 'nested arrays' => array('foo', $index_array, $assoc_array),
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECTF--
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+
+Warning: readgzfile() expects parameter 2 to be long, array given in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/readgzfile_variation9.phpt b/ext/zlib/tests/readgzfile_variation9.phpt
new file mode 100644
index 0000000..5cdb5b5
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation9.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test function readgzfile() by substituting agument 2 with boolean values.
+--SKIPIF--
+<?php
+if (!extension_loaded('zlib')) die ('skip zlib extension not available in this build');
+?>
+--FILE--
+<?php
+
+
+$filename = dirname(__FILE__)."/004.txt.gz";
+
+$variation = array(
+ 'lowercase true' => true,
+ 'lowercase false' =>false,
+ 'uppercase TRUE' =>TRUE,
+ 'uppercase FALSE' =>FALSE,
+ );
+
+
+foreach ( $variation as $var ) {
+ var_dump(readgzfile( $filename, $var ) );
+}
+?>
+===DONE===
+--EXPECT--
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+When you're taught through feelings
+Destiny flying high above
+all I know is that you can realize it
+Destiny who cares
+as it turns around
+and I know that it descends down on me
+int(176)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/reading_include_path.inc b/ext/zlib/tests/reading_include_path.inc
new file mode 100644
index 0000000..ee71bb9
--- /dev/null
+++ b/ext/zlib/tests/reading_include_path.inc
@@ -0,0 +1,27 @@
+<?php
+$thisTestDir = "zlibVariation.dir";
+mkdir($thisTestDir);
+chdir($thisTestDir);
+
+//create the include directory structure
+$workingDir = "workdir";
+$filename = "afile.txt.gz";
+$scriptDir = dirname(__FILE__);
+$baseDir = getcwd();
+$secondFile = $baseDir."/dir2/".$filename;
+$firstFile = "../dir1/".$filename;
+$scriptFile = $scriptDir.'/'.$filename;
+
+$newdirs = array("dir1", "dir2", "dir3");
+$pathSep = ":";
+$newIncludePath = "";
+if(substr(PHP_OS, 0, 3) == 'WIN' ) {
+ $pathSep = ";";
+}
+foreach($newdirs as $newdir) {
+ mkdir($newdir);
+ $newIncludePath .= '../'.$newdir.$pathSep;
+}
+mkdir($workingDir);
+chdir($workingDir);
+?> \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt b/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt
new file mode 100644
index 0000000..74ccc0d
--- /dev/null
+++ b/ext/zlib/tests/zlib_wrapper_fflush_basic.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test function fflush() on a zlib stream wrapper
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+
+$filename = "temp.txt.gz";
+$h = gzopen($filename, 'w');
+$str = "Here is the string to be written.";
+$length = 10;
+var_dump(fflush($h));
+gzwrite( $h, $str);
+gzwrite( $h, $str);
+var_dump(fflush($h));
+gzclose($h);
+
+$h = gzopen($filename, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($filename);
+?>
+===DONE===
+--EXPECT--
+bool(true)
+bool(true)
+Here is the string to be written.Here is the string to be written.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_wrapper_flock_basic.phpt b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
new file mode 100644
index 0000000..9cefce4
--- /dev/null
+++ b/ext/zlib/tests/zlib_wrapper_flock_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test function stream_get_meta_data on a zlib stream
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f,'r');
+var_dump(flock($h, LOCK_SH));
+gzclose($h);
+?>
+===DONE===
+--EXPECT--
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
new file mode 100644
index 0000000..53b140a
--- /dev/null
+++ b/ext/zlib/tests/zlib_wrapper_ftruncate_basic.phpt
@@ -0,0 +1,32 @@
+--TEST--
+Test function ftruncate() on zlib wrapper by calling it with its expected arguments
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$f = dirname(__FILE__)."/004.txt.gz";
+$f2 = "temp.txt.gz";
+copy($f, $f2);
+
+$h = gzopen($f2, "r");
+ftruncate($h, 20);
+fclose($h);
+unlink($f2);
+
+$h = gzopen($f2, "w");
+ftruncate($h, 20);
+fclose($h);
+unlink($f2);
+
+?>
+===DONE===
+--EXPECTF--
+
+Warning: ftruncate(): Can't truncate this stream! in %s on line %d
+
+Warning: ftruncate(): Can't truncate this stream! in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
new file mode 100644
index 0000000..2f76b46
--- /dev/null
+++ b/ext/zlib/tests/zlib_wrapper_meta_data_basic.phpt
@@ -0,0 +1,65 @@
+--TEST--
+Test function stream_get_meta_data on a zlib stream
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+echo "no wrapper\n";
+$f = dirname(__FILE__)."/004.txt.gz";
+$h = gzopen($f,'r');
+var_dump(stream_get_meta_data($h));
+gzclose($h);
+echo "\nwith wrapper\n";
+$f = "compress.zlib://".dirname(__FILE__)."/004.txt.gz";
+$h = fopen($f,'r');
+var_dump(stream_get_meta_data($h));
+gzclose($h);
+
+
+?>
+===DONE===
+--EXPECTF--
+no wrapper
+array(7) {
+ ["stream_type"]=>
+ string(4) "ZLIB"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+
+with wrapper
+array(9) {
+ ["wrapper_type"]=>
+ string(4) "ZLIB"
+ ["stream_type"]=>
+ string(4) "ZLIB"
+ ["mode"]=>
+ string(1) "r"
+ ["unread_bytes"]=>
+ int(0)
+ ["seekable"]=>
+ bool(true)
+ ["uri"]=>
+ string(%d) "compress.zlib://%s/004.txt.gz"
+ ["timed_out"]=>
+ bool(false)
+ ["blocked"]=>
+ bool(true)
+ ["eof"]=>
+ bool(false)
+}
+===DONE=== \ No newline at end of file