summaryrefslogtreecommitdiff
path: root/ext/zlib/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zlib/tests')
-rw-r--r--ext/zlib/tests/data.inc88
-rw-r--r--ext/zlib/tests/gzclose_basic.phpt39
-rw-r--r--ext/zlib/tests/gzclose_error.phpt33
-rw-r--r--ext/zlib/tests/gzcompress_basic1.phpt125
-rw-r--r--ext/zlib/tests/gzcompress_error1.phpt78
-rw-r--r--ext/zlib/tests/gzcompress_variation1.phpt36
-rw-r--r--ext/zlib/tests/gzdeflate_basic1.phpt125
-rw-r--r--ext/zlib/tests/gzdeflate_error1.phpt76
-rw-r--r--ext/zlib/tests/gzdeflate_variation1.phpt36
-rw-r--r--ext/zlib/tests/gzencode_basic1.phpt102
-rw-r--r--ext/zlib/tests/gzencode_error1.phpt98
-rw-r--r--ext/zlib/tests/gzencode_variation1.phpt33
-rw-r--r--ext/zlib/tests/gzencode_variation2.phpt36
-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.phpt108
-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/gzinflate_error1.phpt75
-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.phpt227
-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.phpt173
-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/gzopen_variation8.phpt42
-rw-r--r--ext/zlib/tests/gzopen_variation9.phpt55
-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/gzseek_variation6.phpt39
-rw-r--r--ext/zlib/tests/gzseek_variation7.phpt47
-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/gzuncompress_basic1.phpt43
-rw-r--r--ext/zlib/tests/gzuncompress_error1.phpt84
-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.phpt93
-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_scheme_copy_basic.phpt37
-rw-r--r--ext/zlib/tests/zlib_scheme_copy_variation1.phpt38
-rw-r--r--ext/zlib/tests/zlib_scheme_copy_variation2.phpt53
-rw-r--r--ext/zlib/tests/zlib_scheme_dir_basic.phpt26
-rw-r--r--ext/zlib/tests/zlib_scheme_file_basic.phpt38
-rw-r--r--ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt24
-rw-r--r--ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt31
-rw-r--r--ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt23
-rw-r--r--ext/zlib/tests/zlib_scheme_fopen_basic.phpt25
-rw-r--r--ext/zlib/tests/zlib_scheme_fopen_variation1.phpt30
-rw-r--r--ext/zlib/tests/zlib_scheme_rename_basic.phpt21
-rw-r--r--ext/zlib/tests/zlib_scheme_stat_basic.phpt22
-rw-r--r--ext/zlib/tests/zlib_scheme_stat_basic2.phpt46
-rw-r--r--ext/zlib/tests/zlib_scheme_unlink_basic.phpt21
-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_fstat_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
120 files changed, 6310 insertions, 0 deletions
diff --git a/ext/zlib/tests/data.inc b/ext/zlib/tests/data.inc
new file mode 100644
index 000000000..441199ff0
--- /dev/null
+++ b/ext/zlib/tests/data.inc
@@ -0,0 +1,88 @@
+
+<?php
+$data = <<<QUOTE
+To be or not to be, that is the question;
+Whether 'tis nobler in the mind to suffer
+The Slings and Arrows of outrageous Fortune
+Or to take arms against a sea of troubles,
+And by opposing, end them. To die, to sleep;
+No more; and by a sleep to say we end
+The heart-ache and the thousand natural shocks
+That flesh is heir to 'tis a consummation
+Devoutly to be wish'd. To die, to sleep;
+To sleep, perchance to dream. Ay, there's the rub,
+For in that sleep of death what dreams may come,
+When we have shuffled off this mortal coil,
+Must give us pause. There's the respect
+That makes calamity of so long life,
+For who would bear the whips and scorns of time,
+Th'oppressor's wrong, the proud man's contumely,
+The pangs of dispriz'd love, the law's delay,
+The insolence of office, and the spurns
+That patient merit of th'unworthy takes,
+When he himself might his quietus make
+With a bare bodkin? who would fardels bear,
+To grunt and sweat under a weary life,
+But that the dread of something after death,
+The undiscovered country from whose bourn
+No traveller returns, puzzles the will,
+And makes us rather bear those ills we have
+Than fly to others that we know not of?
+Thus conscience does make cowards of us all,
+And thus the native hue of resolution
+Is sicklied o'er with the pale cast of thought,
+And enterprises of great pitch and moment
+With this regard their currents turn away,
+And lose the name of action.
+
+
+Hath not a Jew eyes? Hath not a Jew hands, organs, dimensions,
+senses, affections, passions; fed with the same food, hurt with
+the same weapons, subject to the same diseases, heal'd by
+the same means, warm'd and cool'd by the same winter and summer
+as a Christian is? If you prick us, do we not bleed? If you
+tickle us, do we not laugh? If you poison us, do we not die?
+And if you wrong us, shall we not revenge? If we are like you
+in the rest, we will resemble you in that. If a Jew wrong a
+Christian, what is his humility? Revenge. If a Christian wrong
+a Jew, what should his sufferance be by Christian example? Why,
+revenge. The villainy you teach me, I will execute, and it
+shall go hard but I will better the instruction.
+
+Is this a dagger which I see before me,
+The handle toward my hand? Come, let me clutch thee.
+I have thee not, and yet I see thee still.
+Art thou not, fatal vision, sensible
+To feeling as to sight? or art thou but
+A dagger of the mind, a false creation,
+Proceeding from the heat-oppress'd brain?
+I see thee yet, in form as palpable
+As this which now I draw.
+Thou marshall'st me the way that I was going;
+And such an instrument I was to use.
+Mine eyes are made the fools o' the other senses,
+Or else worth all the rest; I see thee still,
+And on thy blade and dudgeon gouts of blood,
+Which was not so before.
+There's no such thing:
+It is the bloody business which informs Thus to mine eyes.
+Now o'er the one halfworld Nature seems dead,
+and wicked dreams abuse The curtain'd sleep; witchcraft celebrates
+Pale Hecate's offerings, and wither'd murder,
+Alarum'd by his sentinel, the wolf,
+Whose howl's his watch, thus with his stealthy pace.
+With Tarquin's ravishing strides, towards his design
+Moves like a ghost. Thou sure and firm-set earth,
+Hear not my steps, which way they walk,
+for fear Thy very stones prate of my whereabout,
+And take the present horror from the time,
+Which now suits with it.
+Whiles I threat, he lives:
+Words to the heat of deeds too cold breath gives.
+I go, and it is done; the bell invites me.
+Hear it not, Duncan; for it is a knell
+That summons thee to heaven or to hell.
+
+QUOTE;
+
+?> \ No newline at end of file
diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt
new file mode 100644
index 000000000..d61855bf9
--- /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 000000000..1122b35f0
--- /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: Wrong parameter count for gzclose() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzclose() in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzcompress_basic1.phpt b/ext/zlib/tests/gzcompress_basic1.phpt
new file mode 100644
index 000000000..dddeb1d55
--- /dev/null
+++ b/ext/zlib/tests/gzcompress_basic1.phpt
@@ -0,0 +1,125 @@
+--TEST--
+Test gzcompress() function : basic functionality
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzcompress(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzcompress() : basic functionality ***\n";
+
+// Initialise all required variables
+
+$smallstring = "A small string to compress\n";
+
+
+// Calling gzcompress() with all possible arguments
+
+// Compressing a big string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzcompress($data, $i);
+ var_dump(md5($output));
+ var_dump(strcmp(gzuncompress($output), $data));
+}
+
+// Compressing a smaller string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzcompress($smallstring, $i);
+ var_dump(bin2hex($output));
+ var_dump(strcmp(gzuncompress($output), $smallstring));
+}
+
+// Calling gzcompress() with mandatory arguments
+echo "\n-- Testing with no specified compression level --\n";
+var_dump( bin2hex(gzcompress($smallstring) ));
+
+?>
+===Done===
+--EXPECT--
+*** Testing gzcompress() : basic functionality ***
+-- Compression level -1 --
+string(32) "764809aef15bb34cb73ad49ecb600d99"
+int(0)
+-- Compression level 0 --
+string(32) "d0136b3fb5424142c0eb26dfec8f56fe"
+int(0)
+-- Compression level 1 --
+string(32) "c2e070f4320d1f674965eaab95b53d9c"
+int(0)
+-- Compression level 2 --
+string(32) "400a53d19ca337727f8cd362f5cd3ee0"
+int(0)
+-- Compression level 3 --
+string(32) "a441a2f5169bb303cd45b860a5a9dbf9"
+int(0)
+-- Compression level 4 --
+string(32) "d5b7451e9de2864beccc9de1fc55eb87"
+int(0)
+-- Compression level 5 --
+string(32) "32ba4a01120449ec25508cabfad41f56"
+int(0)
+-- Compression level 6 --
+string(32) "764809aef15bb34cb73ad49ecb600d99"
+int(0)
+-- Compression level 7 --
+string(32) "e083e7e8d05471fed3c2182b9cd0d9eb"
+int(0)
+-- Compression level 8 --
+string(32) "e083e7e8d05471fed3c2182b9cd0d9eb"
+int(0)
+-- Compression level 9 --
+string(32) "e083e7e8d05471fed3c2182b9cd0d9eb"
+int(0)
+-- Compression level -1 --
+string(70) "789c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 0 --
+string(76) "7801011b00e4ff4120736d616c6c20737472696e6720746f20636f6d70726573730a87a509cb"
+int(0)
+-- Compression level 1 --
+string(70) "7801735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 2 --
+string(70) "785e735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 3 --
+string(70) "785e735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 4 --
+string(70) "785e735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 5 --
+string(70) "785e735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 6 --
+string(70) "789c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 7 --
+string(70) "78da735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 8 --
+string(70) "78da735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+-- Compression level 9 --
+string(70) "78da735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+int(0)
+
+-- Testing with no specified compression level --
+string(70) "789c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb"
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt
new file mode 100644
index 000000000..7fa60b900
--- /dev/null
+++ b/ext/zlib/tests/gzcompress_error1.phpt
@@ -0,0 +1,78 @@
+--TEST--
+Test gzcompress() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzcompress(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing gzcompress() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gzcompress() function with Zero arguments --\n";
+var_dump( gzcompress() );
+
+//Test gzcompress with one more than the expected number of arguments
+echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$level = 2;
+$extra_arg = 10;
+var_dump( gzcompress($data, $level, $extra_arg) );
+
+echo "\n-- Testing with incorrect compression level --\n";
+$bad_level = 99;
+var_dump(gzcompress($data, $bad_level));
+
+class Tester {
+ function Hello() {
+ echo "Hello\n";
+ }
+}
+
+echo "\n-- Testing with incorrect parameters --\n";
+$testclass = new Tester();
+var_dump(gzcompress($testclass));
+
+var_dump(gzcompress($data, $testclass));
+
+
+?>
+===Done===
+--EXPECTF--
+*** Testing gzcompress() : error conditions ***
+
+-- Testing gzcompress() function with Zero arguments --
+
+Warning: gzcompress() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gzcompress() function with more than expected no. of arguments --
+
+Warning: gzcompress() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing with incorrect compression level --
+
+Warning: gzcompress(): compression level (99) must be within -1..9 in %s on line %d
+bool(false)
+
+-- Testing with incorrect parameters --
+
+Warning: gzcompress() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: gzcompress() expects parameter 2 to be long, object given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzcompress_variation1.phpt b/ext/zlib/tests/gzcompress_variation1.phpt
new file mode 100644
index 000000000..ef96e4945
--- /dev/null
+++ b/ext/zlib/tests/gzcompress_variation1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test gzcompress() function : variation
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzcompress(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzcompress() : variation ***\n";
+
+
+
+echo "\n-- Testing multiple compression --\n";
+$output = gzcompress($data);
+var_dump(md5($output));
+var_dump(md5(gzcompress($output)));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing gzcompress() : variation ***
+
+-- Testing multiple compression --
+string(32) "764809aef15bb34cb73ad49ecb600d99"
+string(32) "eba942bc2061f23ea8688cc5101872a4"
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzdeflate_basic1.phpt b/ext/zlib/tests/gzdeflate_basic1.phpt
new file mode 100644
index 000000000..823f32035
--- /dev/null
+++ b/ext/zlib/tests/gzdeflate_basic1.phpt
@@ -0,0 +1,125 @@
+--TEST--
+Test gzdeflate() function : basic functionality
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : proto string gzdeflate(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzdeflate() : basic functionality ***\n";
+
+// Initialise all required variables
+
+$smallstring = "A small string to compress\n";
+
+
+// Calling gzdeflate() with all possible arguments
+
+// Compressing a big string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzdeflate($data, $i);
+ var_dump(md5($output));
+ var_dump(strcmp(gzinflate($output), $data));
+}
+
+// Compressing a smaller string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzdeflate($smallstring, $i);
+ var_dump(bin2hex($output));
+ var_dump(strcmp(gzinflate($output), $smallstring));
+}
+
+// Calling gzdeflate() with just mandatory arguments
+echo "\n-- Testing with no specified compression level --\n";
+var_dump( bin2hex(gzdeflate($smallstring) ));
+
+?>
+===Done===
+--EXPECT--
+*** Testing gzdeflate() : basic functionality ***
+-- Compression level -1 --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+int(0)
+-- Compression level 0 --
+string(32) "a71e54d2499aff9e48643cb1c260b60c"
+int(0)
+-- Compression level 1 --
+string(32) "05e80f4dc0d422e1f333cbed555d381f"
+int(0)
+-- Compression level 2 --
+string(32) "0fb33656e4ed0750f977df83246fce7a"
+int(0)
+-- Compression level 3 --
+string(32) "bc6e9c1dccc3e951e006315ee669ee08"
+int(0)
+-- Compression level 4 --
+string(32) "a61727d7a28c634470eb6e97a4a81b24"
+int(0)
+-- Compression level 5 --
+string(32) "a2a1a14b7542c82e8943200d093d5f27"
+int(0)
+-- Compression level 6 --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+int(0)
+-- Compression level 7 --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+int(0)
+-- Compression level 8 --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+int(0)
+-- Compression level 9 --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+int(0)
+-- Compression level -1 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 0 --
+string(64) "011b00e4ff4120736d616c6c20737472696e6720746f20636f6d70726573730a"
+int(0)
+-- Compression level 1 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 2 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 3 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 4 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 5 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 6 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 7 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 8 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+-- Compression level 9 --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+int(0)
+
+-- Testing with no specified compression level --
+string(58) "735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200"
+===Done===
diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt
new file mode 100644
index 000000000..78491af9f
--- /dev/null
+++ b/ext/zlib/tests/gzdeflate_error1.phpt
@@ -0,0 +1,76 @@
+--TEST--
+Test gzdeflate() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzdeflate(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * add a comment here to say what the test is supposed to do
+ */
+
+echo "*** Testing gzdeflate() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gzdeflate() function with Zero arguments --\n";
+var_dump( gzdeflate() );
+
+//Test gzdeflate with one more than the expected number of arguments
+echo "\n-- Testing gzdeflate() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$level = 2;
+$extra_arg = 10;
+var_dump( gzdeflate($data, $level, $extra_arg) );
+
+echo "\n-- Testing with incorrect compression level --\n";
+$bad_level = 99;
+var_dump(gzdeflate($data, $bad_level));
+
+class Tester {
+ function Hello() {
+ echo "Hello\n";
+ }
+}
+
+echo "\n-- Testing with incorrect parameters --\n";
+$testclass = new Tester();
+var_dump(gzdeflate($testclass));
+var_dump(gzdeflate($data, $testclass));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing gzdeflate() : error conditions ***
+
+-- Testing gzdeflate() function with Zero arguments --
+
+Warning: gzdeflate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gzdeflate() function with more than expected no. of arguments --
+
+Warning: gzdeflate() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing with incorrect compression level --
+
+Warning: gzdeflate(): compression level (99) must be within -1..9 in %s on line %d
+bool(false)
+
+-- Testing with incorrect parameters --
+
+Warning: gzdeflate() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: gzdeflate() expects parameter 2 to be long, object given in %s on line %d
+NULL
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzdeflate_variation1.phpt b/ext/zlib/tests/gzdeflate_variation1.phpt
new file mode 100644
index 000000000..75eb16e03
--- /dev/null
+++ b/ext/zlib/tests/gzdeflate_variation1.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test gzdeflate() function : variation
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzdeflate(string data [, int level])
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzdeflate() : variation ***\n";
+
+
+
+echo "\n-- Testing multiple compression --\n";
+$output = gzdeflate($data);
+var_dump( md5($output));
+var_dump(md5(gzdeflate($output)));
+
+?>
+===Done===
+--EXPECT--
+*** Testing gzdeflate() : variation ***
+
+-- Testing multiple compression --
+string(32) "078554fe65e06f6ff01eab51cfc7ae9b"
+string(32) "86b9f895ef1377da5269ec3cb2729f71"
+===Done===
diff --git a/ext/zlib/tests/gzencode_basic1.phpt b/ext/zlib/tests/gzencode_basic1.phpt
new file mode 100644
index 000000000..9b3dcc8a3
--- /dev/null
+++ b/ext/zlib/tests/gzencode_basic1.phpt
@@ -0,0 +1,102 @@
+--TEST--
+Test gzencode() function : basic functionality
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * Test basic function of gzencode
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzencode() : basic functionality ***\n";
+
+// Initialise all required variables
+
+$smallstring = "A small string to compress\n";
+
+
+// Calling gzencode() with various compression levels
+
+// Compressing a big string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzencode($data, $i);
+
+ // Clear OS byte before encode
+ $output[9] = "\x00";
+
+ var_dump(md5($output));
+}
+
+// Compressing a smaller string
+for($i = -1; $i < 10; $i++) {
+ echo "-- Compression level $i --\n";
+ $output = gzencode($smallstring, $i);
+
+ // Clear OS byte before encode
+ $output[9] = "\x00";
+
+ var_dump(md5($output));
+}
+
+?>
+===Done===
+--EXPECTF--
+*** Testing gzencode() : basic functionality ***
+-- Compression level -1 --
+string(32) "d9ede02415ce91d21e5a94274e2b9c42"
+-- Compression level 0 --
+string(32) "67aaf60426bb2cbd86d7fe530cb12306"
+-- Compression level 1 --
+string(32) "bce9c439cf767c1988ff4881b287d1ce"
+-- Compression level 2 --
+string(32) "7ddbfed63a76c42808722b66f1c133fc"
+-- Compression level 3 --
+string(32) "ca2b85d194dfa2a4e8a162b646c99265"
+-- Compression level 4 --
+string(32) "cfe28033eaf260bc33ddc04b53d3ba39"
+-- Compression level 5 --
+string(32) "ae357fada2b515422f8bea0aa3bcc48f"
+-- Compression level 6 --
+string(32) "d9ede02415ce91d21e5a94274e2b9c42"
+-- Compression level 7 --
+string(32) "d9ede02415ce91d21e5a94274e2b9c42"
+-- Compression level 8 --
+string(32) "d9ede02415ce91d21e5a94274e2b9c42"
+-- Compression level 9 --
+string(32) "d9ede02415ce91d21e5a94274e2b9c42"
+-- Compression level -1 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 0 --
+string(32) "36220d650930849b67e8e0622f9bf270"
+-- Compression level 1 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 2 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 3 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 4 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 5 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 6 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 7 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 8 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+-- Compression level 9 --
+string(32) "f77bd31e1e4dd11d12828fb661a08010"
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzencode_error1.phpt b/ext/zlib/tests/gzencode_error1.phpt
new file mode 100644
index 000000000..ed8c97747
--- /dev/null
+++ b/ext/zlib/tests/gzencode_error1.phpt
@@ -0,0 +1,98 @@
+--TEST--
+Test gzencode() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+/*
+ * Test error cases for gzencode
+ */
+
+echo "*** Testing gzencode() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gzencode() function with Zero arguments --\n";
+var_dump( gzencode() );
+
+//Test gzencode with one more than the expected number of arguments
+echo "\n-- Testing gzencode() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$level = 2;
+$encoding_mode = FORCE_DEFLATE;
+$extra_arg = 10;
+var_dump( gzencode($data, $level, $encoding_mode, $extra_arg) );
+
+echo "\n-- Testing with incorrect compression level --\n";
+$bad_level = 99;
+var_dump(gzencode($data, $bad_level));
+
+echo "\n-- Testing with incorrect encoding_mode --\n";
+$bad_mode = 99;
+var_dump(gzencode($data, $level, $bad_mode));
+
+class Tester {
+ function Hello() {
+ echo "Hello\n";
+ }
+}
+
+echo "\n-- Testing with incorrect parameters --\n";
+$testclass = new Tester();
+var_dump(gzencode($testclass));
+var_dump(gzencode($data, $testclass));
+var_dump(gzencode($data, -1, 99.99));
+var_dump(gzencode($data, -1, $testclass));
+var_dump(gzencode($data, "a very none numeric string\n"));
+
+?>
+===Done===
+--EXPECTF--
+*** Testing gzencode() : error conditions ***
+
+-- Testing gzencode() function with Zero arguments --
+
+Warning: gzencode() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gzencode() function with more than expected no. of arguments --
+
+Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d
+NULL
+
+-- Testing with incorrect compression level --
+
+Warning: gzencode(): compression level(99) must be within -1..9 in %s on line %d
+bool(false)
+
+-- Testing with incorrect encoding_mode --
+
+Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d
+bool(false)
+
+-- Testing with incorrect parameters --
+
+Warning: gzencode() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: gzencode() expects parameter 2 to be long, object given in %s on line %d
+NULL
+
+Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d
+bool(false)
+
+Warning: gzencode() expects parameter 3 to be long, object given in %s on line %d
+NULL
+
+Warning: gzencode() 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/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt
new file mode 100644
index 000000000..47e2097f5
--- /dev/null
+++ b/ext/zlib/tests/gzencode_variation1.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Test gzencode() function : variation
+--SKIPIF--
+<?php
+
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzencode() : variation ***\n";
+
+echo "\n-- Testing multiple compression --\n";
+$output = gzencode($data);
+var_dump(bin2hex(gzencode($output)));
+
+?>
+===Done===
+--EXPECT--
+*** Testing gzencode() : variation ***
+
+-- Testing multiple compression --
+string(3658) "1f8b0800000000000003010e07f1f81f8b08000000000000036d574d6fe4c80dbdeb57d4ad2f3dfe01eb83e1ec22980e309b4562c067b64449159754dafab0b6e7d7e73d96da1e4c72184c4b2ab2c8f7c847fa25baabba98dc1a8b2b7c38bb324b713ee37f757f56cdc5c7f5b17b9d152f923b157c5ae335e0b75fedd0e2d781c6b98ea3a6ee05affe1dfc3a6527f8f09c52dcb38ba38bb5249934d6ecfe1e53a9ab76ff4c342cf2a64ed2028349fc9a8b139755685352acb82b9fbb67f8bade5cdcb698e1fcec94b7ceba3cb897e806cfc8114350dd1ebbdfa35b62d2478b0056d23ed809b9b95d696d91ce2aa97c911e3fa539c43f84c887554a4d125c9e63ff96711cc08c0866263cb37a0bbe2122ae8f6baecb2284abfb4ddf916db8354cddeef37c1afe5fa02fc7afb3db34f5b3acbdf2eb905490d8f38d7468d253a323d5ebb903760d7944d3b2024e834a99ddce77669bdd823cfbb8e899d4ad4c799677452e6029e80023a03b2374005590641f7d3877df2ad09f3c0e82a54d6a5644fd63049a37ed4bc362016fd9f51264f1e5c630727421ae930b7ed416e93e47b7c71a400390361ffbecb7561bb98f69b5da289e91becc27f08b3b724cb8704f9144d366431d0cb870c56b205deaa2e17636063761a911039fb7e4bf9f06c4f0aecd2ec80e8b41831ca7515e31286166458ea3ef71f2ce7cde2ae269c96d60525724a9c9170b713ed5750758f3cd2a361fc8b288fc92358ce884692e8ea0fe59bd969a0da2eed5831b715749eaae7178f3ebd30fb88c92105f367cce2c882955dc6bf8eca0d5d57540b3092894743ba0fd5b2dad021836191f1afc0bba14dde1642cb0b1aa6879c38907dcefa0720082b801bec61417469219175267dfa047df35b0bd1332001c28cdfafd3bcabe91e74368cdd8d8478e494c190e7ee90c67f2bde288e68ab6b15e883c995be4f8feb6c6dda4278e4f38578ddbdc7be36788daf0c3cb1d1819c73822f7000a0d1813fa94153b572315e51343b536bc64977dff163cebfd8418773261f524017e251fccc60ae29a5770ae097594d52e9c1229d87ce967a36401c46b69945afb249d101c9d420ffa9a123e232c20e76467d5d169202a2dd4c582949e013e745df7958d4b0cc4fd4377a737cd4feea7974070000f314d423e0634cb9a618fdf5dc64fd422181fd59c9230c9f6f9d18dc8fc23e9cccbc7188733b04aa57de83ebea0be3633cff5fa1ff83269be7f44f5a8d84550cc703255fd345dd402034d0b3e11a73ec6e3d4a77f4f685b614329f1b3132ae7af33d02e1e55e291fa6574b758d1f0200e7423dbc852211818043a7c9ce80aa9d59fce0401959f5ea2cf71fde90824f8c9192dbe9d329db143794675ddcf257dd7755273b67340414e3ccad12e3f661f8aad9cf9957dc1275d10a51d3934fa81e68dc6768fb8ee23e373936c8e13feab8b0f50d227f7af76f561fb0950f3d099bbc316c3892a42fb36806d8660e800fa4f43fd4b962d2097d71933a54b77ff948677848eb17bb3a88b621682cfb3bbb49cf42fed6b3944124ad8358ca688aa44dd5f2144c7c9ab16f25b9aca9654ef357ec9ad55c40d324d6cc3d9e3920b863c231d31a95d937fb5520f9c816c79b7dcecc593fb9593cc05a51ebb1eeddd5b49eb437769738d0f64adc579d372b8b7f7c0208487ee3915ebf5766e148ebd77cf4e01f3ec285047011e55838968b6494d517fe29224777b24dd3ddf933101695b102e87db805eef291b74dcfd91628fb2a53f93dbd2968ef2e598746c9204f89fba1f0246fc671610a0591806e46a1346f77c40d910a47c5e20ffb23f003c04b648327a4ed98032c1965bd35bb0044f5344248f56fdb99aa61d6451d68e33489a83bffbe6573541b2da5f64681ea12090f778b2075374778810f73965fa3626a9d41f4df2f83f7c34658cec921b5a9bde49dd5007ec882b02adc514f81aa85898b5cc98e1b137733c0a8789b7f5648d2d231b80bf74978f25d61ce08a8abd11801fd8f995e066676307192ff7641f1cc6e0dee68565b8b22ac3889cd067bf732754a6b270af1044c6a8776811a4f6d8bd0477a9f516064201b920b92d7cd4dc7eee13e6b3eb3528a82f9abb3f388ebe6a8f871393461b73816ec54c99d604174bc5a6801de13908f86aea6a7d0fea107d682bcf1ec348b83872e6b8a316ecd02eb8f8dc86a609bf59a2dd03f1dfa4079436d55e24617be1a2854d008b2b2b1705e2078a7f3946318df1c24f6bf70d4b456eca286ec2b585b28262cc048a098c3e2d5f325a92bb36f691afdc14c822da1b116c9c1c07bb362eb0a04b78834c812134230ebf2044ac2e3c0e3ad00f848dc5010f3bf917ec2fc700b7bf26dacea8440620e04f90f4d97d6dd77cfde8a05c7d3930f1e5811fb8ec5c70964dcc8187ec90e32fdd6b64eec7586413b7d55bed65c4cce39a9b6c15e70e9da94e53fc904e6286f01f5b5562c94211befbc23507e01b2a3865e2f45b5d7b591f290087a5605b82495b4e393f31aa5b37211ec40241a746d903c5eebf117a4d3ddb0d00007b64cbc70e070000"
+===Done=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt
new file mode 100644
index 000000000..901cd53c1
--- /dev/null
+++ b/ext/zlib/tests/gzencode_variation2.phpt
@@ -0,0 +1,36 @@
+--TEST--
+Test gzencode() function : variation - verify header contents with all encoding modes
+--SKIPIF--
+<?php
+
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzencode ( string $data [, int $level [, int $encoding_mode ]] )
+ * Description: Gzip-compress a string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+echo "*** Testing gzencode() : variation ***\n";
+
+$data = "A small string to encode\n";
+
+echo "\n-- Testing with each encoding_mode --\n";
+var_dump(bin2hex(gzencode($data, -1)));
+var_dump(bin2hex(gzencode($data, -1, FORCE_GZIP)));
+var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE)));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzencode() : variation ***
+
+-- Testing with each encoding_mode --
+string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
+string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000"
+string(86) "1f8b0800000000000003789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd"
+===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 000000000..f5d2617a9
--- /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 000000000..68f53a7c2
--- /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: Wrong parameter count for gzeof() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzeof() in %s on line %d
+NULL
+===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 000000000..6d1e0401d
--- /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 000000000..1fceea5b9
--- /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 000000000..9f31eb0f8
--- /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 000000000..6089f3ebf
--- /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 000000000..b573030f9
--- /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 000000000..2a6d8915d
--- /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 000000000..02faa4501
--- /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 000000000..a8efc7616
--- /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 000000000..8014d7d9d
--- /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 000000000..8eb183c1c
--- /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 000000000..2a21a36d5
--- /dev/null
+++ b/ext/zlib/tests/gzfile_variation15.phpt
@@ -0,0 +1,108 @@
+--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 fail to read the file
+ 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"
+}
+
+
+Warning: gzfile(afile.txt.gz): failed to open stream: No such file or directory in %s on line %d
+bool(false)
+
+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 000000000..2f75c7f81
--- /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 000000000..8a6f2cec2
--- /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 000000000..b3c8ac483
--- /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 000000000..5e210b653
--- /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 000000000..174524b3d
--- /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 000000000..b441dd670
--- /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 000000000..32d969326
--- /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 000000000..c2c24ae26
--- /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 000000000..ca2e38c0e
--- /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 000000000..14e6528a3
--- /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: Wrong parameter count for gzgetc() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzgetc() in %s on line %d
+NULL
+===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 000000000..3ebc75900
--- /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 000000000..88099ff51
--- /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: Wrong parameter count for gzgets() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzgets() in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzinflate_error1.phpt b/ext/zlib/tests/gzinflate_error1.phpt
new file mode 100644
index 000000000..6dc811364
--- /dev/null
+++ b/ext/zlib/tests/gzinflate_error1.phpt
@@ -0,0 +1,75 @@
+--TEST--
+Test gzinflate() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzinflate(string data [, int length])
+ * Description: Unzip a gzip-compressed string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzinflate() : error conditions ***\n";
+
+echo "\n-- Testing gzcompress() function with Zero arguments --\n";
+var_dump( gzinflate() );
+
+echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$length = 10;
+$extra_arg = 10;
+var_dump( gzinflate($data, $length, $extra_arg) );
+
+echo "\n-- Testing with a buffer that is too small --\n";
+$short_len = strlen($data) - 1;
+$compressed = gzcompress($data);
+
+var_dump(gzinflate($compressed, $short_len));
+
+echo "\n-- Testing with incorrect parameters --\n";
+
+class Tester {
+ function Hello() {
+ echo "Hello\n";
+ }
+}
+
+$testclass = new Tester();
+var_dump(gzinflate($testclass));
+var_dump(gzinflate($data, $testclass));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzinflate() : error conditions ***
+
+-- Testing gzcompress() function with Zero arguments --
+
+Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gzcompress() function with more than expected no. of arguments --
+
+Warning: gzinflate() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing with a buffer that is too small --
+
+Warning: gzinflate(): data error in %s on line %d
+bool(false)
+
+-- Testing with incorrect parameters --
+
+Warning: gzinflate() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: gzinflate() expects parameter 2 to be long, object given in %s on line %d
+NULL
+===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 000000000..e3697731d
--- /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 000000000..5cc02cd18
--- /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 000000000..a71791fb2
--- /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 000000000..7d6723a81
--- /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 000000000..ea4836f24
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation1.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)
+$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 000000000..458293514
--- /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 000000000..1f6eb9bc2
--- /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 !== false && $res != NULL) {
+ 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 000000000..17f64d9c1
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation4.phpt
@@ -0,0 +1,173 @@
+--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 fail to read the file
+ $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
+
+Warning: gzopen(afile.txt.gz): failed to open stream: No such file or directory in %s on line %d
+
+Warning: gzpassthru(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource in %s on line %d
+
+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(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource 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(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource 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(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource 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(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource 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(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource 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
+
+Warning: gzopen(afile.txt.gz): failed to open stream: No such file or directory in %s on line %d
+
+Warning: gzpassthru(): supplied argument is not a valid stream resource in %s on line %d
+
+Warning: gzclose(): supplied argument is not a valid stream resource in %s on line %d
+
+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 000000000..ec1bfa3c4
--- /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 ***
+Not created in working dir
+created in dir1
+Not created in working dir
+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 000000000..9fe3f24b4
--- /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 000000000..92642b099
--- /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/gzopen_variation8.phpt b/ext/zlib/tests/gzopen_variation8.phpt
new file mode 100644
index 000000000..bb0126227
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation8.phpt
@@ -0,0 +1,42 @@
+--TEST--
+Test gzopen() function : variation: opening a plain 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";
+
+$data = <<<EOT
+Here is some plain
+text to be read
+and displayed.
+EOT;
+
+$file = "gzopen_variation8.tmp";
+$h = fopen($file, 'w');
+fwrite($h, $data);
+fclose($h);
+
+$h = gzopen($file, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($file);
+?>
+===DONE===
+--EXPECT--
+*** Testing gzopen() : variation ***
+Here is some plain
+text to be read
+and displayed.
+===DONE===
diff --git a/ext/zlib/tests/gzopen_variation9.phpt b/ext/zlib/tests/gzopen_variation9.phpt
new file mode 100644
index 000000000..7a44b6eb0
--- /dev/null
+++ b/ext/zlib/tests/gzopen_variation9.phpt
@@ -0,0 +1,55 @@
+--TEST--
+Test gzopen() function : variation: try opening with possibly invalid modes
+--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";
+
+$modes = array('r+', 'rf', 'w+' , 'e');
+
+$file = dirname(__FILE__)."/004.txt.gz";
+
+foreach ($modes as $mode) {
+ echo "mode=$mode\n";
+ $h = gzopen($file, $mode);
+ echo "gzopen=";
+ var_dump($h);
+ if ($h !== false) {
+ gzclose($h);
+ }
+ echo "\n";
+}
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzopen() : variation ***
+mode=r+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+gzopen=bool(false)
+
+mode=rf
+gzopen=resource(%d) of type (stream)
+
+mode=w+
+
+Warning: gzopen(): cannot open a zlib stream for reading and writing at the same time! in %s on line %d
+gzopen=bool(false)
+
+mode=e
+
+Warning: gzopen(%s/004.txt.gz): failed to open stream: %s in %s on line %d
+gzopen=bool(false)
+
+===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 000000000..931c2b22c
--- /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 000000000..fda584f6d
--- /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: Wrong parameter count for gzpassthru() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzpassthru() in %s on line %d
+NULL
+===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 000000000..7566e74e7
--- /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 000000000..ecb62a825
--- /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 000000000..eab0f7dd7
--- /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: Wrong parameter count for gzread() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzread() in %s on line %d
+NULL
+===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 000000000..fae635641
--- /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 000000000..1f50d7712
--- /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 000000000..959f0fcde
--- /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 000000000..f51751c61
--- /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 000000000..c6f2456b2
--- /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: Wrong parameter count for gzrewind() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzrewind() in %s on line %d
+NULL
+===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 000000000..82018627f
--- /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 000000000..d641bad42
--- /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 000000000..a815b8ff4
--- /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 000000000..a7ca275e4
--- /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: Wrong parameter count for gzseek() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzseek() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzseek() in %s on line %d
+NULL
+===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 000000000..301b57d15
--- /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 000000000..e70d6dd84
--- /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 000000000..dee7c1302
--- /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 000000000..fc641f6c8
--- /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 000000000..0167e204c
--- /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/gzseek_variation6.phpt b/ext/zlib/tests/gzseek_variation6.phpt
new file mode 100644
index 000000000..0c4630953
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation6.phpt
@@ -0,0 +1,39 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_END 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');
+// move 40 bytes
+echo "move 40 bytes\n";
+gzread($h, 40);
+echo "tell=";
+var_dump(gztell($h));
+echo "move to the end\n";
+var_dump(gzseek( $h, 0, SEEK_END ) );
+echo "tell=";
+var_dump(gztell($h));
+echo "eof=";
+var_dump(gzeof($h));
+//read the next 10
+var_dump(gzread($h, 10));
+gzclose($h);
+?>
+===DONE===
+--EXPECTF--
+move 40 bytes
+tell=int(40)
+move to the end
+
+Warning: gzseek(): SEEK_END is not supported in %s on line %d
+int(-1)
+tell=int(40)
+eof=bool(false)
+string(10) "iny flying"
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzseek_variation7.phpt b/ext/zlib/tests/gzseek_variation7.phpt
new file mode 100644
index 000000000..aab083465
--- /dev/null
+++ b/ext/zlib/tests/gzseek_variation7.phpt
@@ -0,0 +1,47 @@
+--TEST--
+Test function gzseek() by calling it with SEEK_END 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=";
+var_dump(gztell($h));
+
+//seek to the end which is not sensible of course.
+echo "move to the end of the file\n";
+var_dump(gzseek($h, 0, SEEK_END));
+echo "tell=";
+var_dump(gztell($h));
+gzwrite($h, $str2);
+echo "tell=";
+var_dump(gztell($h));
+gzclose($h);
+echo "\nreading the output file\n";
+$h = gzopen($f, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($f);
+?>
+===DONE===
+--EXPECTF--
+tell=int(23)
+move to the end of the file
+
+Warning: gzseek(): SEEK_END is not supported in %s on line %d
+int(-1)
+tell=int(23)
+tell=int(47)
+
+reading the output file
+This is the first line.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 000000000..b6baf427d
--- /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 000000000..a8574eeaa
--- /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 000000000..63f3b9cef
--- /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: Wrong parameter count for gztell() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gztell() in %s on line %d
+NULL
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzuncompress_basic1.phpt b/ext/zlib/tests/gzuncompress_basic1.phpt
new file mode 100644
index 000000000..fa7f1759e
--- /dev/null
+++ b/ext/zlib/tests/gzuncompress_basic1.phpt
@@ -0,0 +1,43 @@
+--TEST--
+Test gzuncompress() function : basic functionality
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzuncompress(string data [, int length])
+ * Description: Unzip a gzip-compressed string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+include(dirname(__FILE__) . '/data.inc');
+
+echo "*** Testing gzuncompress() : basic functionality ***\n";
+
+
+// Initialise all required variables
+$compressed = gzcompress($data);
+
+echo "\n-- Basic decompress --\n";
+var_dump(strcmp($data, gzuncompress($compressed)));
+
+
+$length = 3547;
+echo "\n-- Calling gzuncompress() with max length of $length --\n";
+echo "Result length is ". strlen(gzuncompress($compressed, $length)) . "\n";
+
+?>
+===DONE===
+--EXPECT--
+*** Testing gzuncompress() : basic functionality ***
+
+-- Basic decompress --
+int(0)
+
+-- Calling gzuncompress() with max length of 3547 --
+Result length is 3547
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/gzuncompress_error1.phpt b/ext/zlib/tests/gzuncompress_error1.phpt
new file mode 100644
index 000000000..66e5b2ac4
--- /dev/null
+++ b/ext/zlib/tests/gzuncompress_error1.phpt
@@ -0,0 +1,84 @@
+--TEST--
+Test gzuncompress() function : error conditions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+/* Prototype : string gzuncompress(string data [, int length])
+ * Description: Unzip a gzip-compressed string
+ * Source code: ext/zlib/zlib.c
+ * Alias to functions:
+ */
+
+
+
+echo "*** Testing gzuncompress() : error conditions ***\n";
+
+// Zero arguments
+echo "\n-- Testing gzuncompress() function with Zero arguments --\n";
+var_dump( gzuncompress() );
+
+//Test gzuncompress with one more than the expected number of arguments
+echo "\n-- Testing gzuncompress() function with more than expected no. of arguments --\n";
+$data = 'string_val';
+$length = 10;
+$extra_arg = 10;
+var_dump( gzuncompress($data, $length, $extra_arg) );
+
+
+echo "\n-- Testing with a buffer that is too small --\n";
+$short_len = strlen($data) - 1;
+$compressed = gzcompress($data);
+
+var_dump(gzuncompress($compressed, $short_len));
+
+
+echo "\n-- Testing with incorrect arguments --\n";
+var_dump(gzuncompress(123));
+
+class Tester {
+ function Hello() {
+ echo "Hello\n";
+ }
+}
+
+$testclass = new Tester();
+var_dump(gzuncompress($testclass));
+
+var_dump(gzuncompress($compressed, "this is not a number\n"));
+
+?>
+===DONE===
+--EXPECTF--
+*** Testing gzuncompress() : error conditions ***
+
+-- Testing gzuncompress() function with Zero arguments --
+
+Warning: gzuncompress() expects at least 1 parameter, 0 given in %s on line %d
+NULL
+
+-- Testing gzuncompress() function with more than expected no. of arguments --
+
+Warning: gzuncompress() expects at most 2 parameters, 3 given in %s on line %d
+NULL
+
+-- Testing with a buffer that is too small --
+
+Warning: gzuncompress(): buffer error in %s on line %d
+bool(false)
+
+-- Testing with incorrect arguments --
+
+Warning: gzuncompress(): data error in %s on line %d
+bool(false)
+
+Warning: gzuncompress() expects parameter 1 to be string, object given in %s on line %d
+NULL
+
+Warning: gzuncompress() 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/gzwrite_basic.phpt b/ext/zlib/tests/gzwrite_basic.phpt
new file mode 100644
index 000000000..0d7521625
--- /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 000000000..b77c64869
--- /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: Wrong parameter count for gzwrite() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzwrite() in %s on line %d
+NULL
+
+Warning: Wrong parameter count for gzwrite() in %s on line %d
+NULL
+===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 000000000..691275055
--- /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 000000000..bd3778e36
--- /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 000000000..2d180c1a5
--- /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 000000000..99d216a55
--- /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 000000000..4ec76d017
--- /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 000000000..e31824ce1
--- /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 000000000..29249a1f2
--- /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 000000000..4023211ff
--- /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 000000000..8c291a4f4
--- /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 000000000..117860eb4
--- /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 000000000..165bf59b8
--- /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 000000000..43935b10a
--- /dev/null
+++ b/ext/zlib/tests/readgzfile_variation15.phpt
@@ -0,0 +1,93 @@
+--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 fail to read the file
+ 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:
+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 000000000..367cc401b
--- /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 000000000..6645d67b7
--- /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 000000000..cbc561c71
--- /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 000000000..dde0dabdd
--- /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 000000000..1beeca764
--- /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 000000000..df244d395
--- /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 000000000..2e155288f
--- /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 000000000..5cdb5b5da
--- /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 000000000..ee71bb9c4
--- /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_scheme_copy_basic.phpt b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
new file mode 100644
index 000000000..028c029e6
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_copy_basic.phpt
@@ -0,0 +1,37 @@
+--TEST--
+Test compress.zlib:// scheme with the copy function: compressed to compressed
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$outputFileName = __FILE__.'.tmp';
+
+$srcFile = "compress.zlib://$inputFileName";
+$destFile = "compress.zlib://$outputFileName";
+copy($srcFile, $destFile);
+
+$h = gzopen($inputFileName, 'r');
+$org_data = gzread($h, 4096);
+gzclose($h);
+
+$h = gzopen($outputFileName, 'r');
+$copied_data = gzread($h, 4096);
+gzclose($h);
+
+if ($org_data == $copied_data) {
+ echo "OK: Copy identical\n";
+}
+else {
+ echo "FAILED: Copy not identical";
+}
+unlink($outputFileName);
+?>
+===DONE===
+--EXPECT--
+OK: Copy identical
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_copy_variation1.phpt b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
new file mode 100644
index 000000000..3c997ef7e
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_copy_variation1.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test compress.zlib:// scheme with the copy function: compressed to uncompressed
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$outputFileName = __FILE__.'.tmp';
+
+$srcFile = "compress.zlib://$inputFileName";
+$destFile = $outputFileName;
+copy($srcFile, $destFile);
+
+$h = gzopen($inputFileName, 'r');
+$org_data = gzread($h, 4096);
+gzclose($h);
+
+// can only read uncompressed data
+$h = fopen($outputFileName, 'r');
+$copied_data = fread($h, 4096);
+gzclose($h);
+
+if ($org_data == $copied_data) {
+ echo "OK: Copy identical\n";
+}
+else {
+ echo "FAILED: Copy not identical";
+}
+unlink($outputFileName);
+?>
+===DONE===
+--EXPECT--
+OK: Copy identical
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_copy_variation2.phpt b/ext/zlib/tests/zlib_scheme_copy_variation2.phpt
new file mode 100644
index 000000000..0b56ec430
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_copy_variation2.phpt
@@ -0,0 +1,53 @@
+--TEST--
+Test compress.zlib:// scheme with the copy function: uncompressed to compressed
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$org_data = <<<EOT
+uncompressed contents of 004.txt.gz is:
+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
+EOT;
+
+$inputFileName = __FILE__.'.org';
+$outputFileName = __FILE__.'.tmp';
+
+file_put_contents($inputFileName, $org_data);
+
+$srcFile = $inputFileName;
+$destFile = "compress.zlib://$outputFileName";
+copy($srcFile, $destFile);
+
+$h = gzopen($outputFileName, 'r');
+$copied_data = gzread($h, 4096);
+gzclose($h);
+
+//gzopen can read compressed and uncompressed so we
+//also need to look for the magic number (x1f x8b) to prove it
+//was compressed.
+$h = fopen($outputFileName, 'r');
+$magic = fread($h, 2);
+fclose($h);
+
+if ($org_data == $copied_data && bin2hex($magic) === '1f8b') {
+ echo "OK: Copy identical\n";
+}
+else {
+ echo "FAILED: Copy not identical\n";
+}
+unlink($inputFileName);
+unlink($outputFileName);
+?>
+===DONE===
+--EXPECT--
+OK: Copy identical
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_dir_basic.phpt b/ext/zlib/tests/zlib_scheme_dir_basic.phpt
new file mode 100644
index 000000000..02fe4fd35
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_dir_basic.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Test compress.zlib:// scheme with the directory functions
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/dir.gz";
+$srcFile = "compress.zlib://$inputFileName";
+var_dump(mkdir($srcFile));
+var_dump(is_dir($srcFile));
+var_dump(opendir($srcFile));
+var_dump(rmdir($srcFile));
+?>
+===DONE===
+--EXPECTF--
+bool(false)
+bool(false)
+
+Warning: opendir(compress.zlib://%s/dir.gz): failed to open dir: not implemented in %s on line %d
+bool(false)
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_basic.phpt
new file mode 100644
index 000000000..b8b60e40e
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_file_basic.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Test compress.zlib:// scheme with the file
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+$contents = file($srcFile);
+var_dump($contents);
+?>
+===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
+"
+}
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
new file mode 100644
index 000000000..c679c46be
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_file_get_contents_basic.phpt
@@ -0,0 +1,24 @@
+--TEST--
+Test compress.zlib:// scheme with the file_get_contents
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+$contents = file_get_contents($srcFile);
+echo $contents;
+?>
+===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
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt b/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt
new file mode 100644
index 000000000..8ea41df5a
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_file_put_contents_basic.phpt
@@ -0,0 +1,31 @@
+--TEST--
+Test compress.zlib:// scheme with the file_get_contents
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$outputFileName = __FILE__.'tmp';
+$outFile = "compress.zlib://$outputFileName";
+$data = <<<EOT
+Here is some plain
+text to be read
+and displayed.
+EOT;
+
+file_put_contents($outFile, $data);
+$h = gzopen($outputFileName, 'r');
+gzpassthru($h);
+gzclose($h);
+echo "\n";
+unlink($outputFileName);
+?>
+===DONE===
+--EXPECT--
+Here is some plain
+text to be read
+and displayed.
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
new file mode 100644
index 000000000..ef44292c3
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_file_read_file_basic.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Test compress.zlib:// scheme with the file_get_contents
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+readfile($srcFile);
+?>
+===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
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_fopen_basic.phpt b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
new file mode 100644
index 000000000..d6d4514f7
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_fopen_basic.phpt
@@ -0,0 +1,25 @@
+--TEST--
+Test compress.zlib:// scheme with the fopen
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+$h = fopen($srcFile, 'r');
+fpassthru($h);
+fclose($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
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
new file mode 100644
index 000000000..8c26492ef
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_fopen_variation1.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Test compress.zlib:// scheme with the fopen on a file scheme
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "file://$inputFileName";
+$compressedFile = "compress.zlib://$srcFile";
+
+echo "file=$compressedFile\n\n";
+$h = fopen($compressedFile, 'r');
+fpassthru($h);
+fclose($h);
+?>
+===DONE===
+--EXPECTF--
+file=compress.zlib://file://%s/004.txt.gz
+
+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=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_rename_basic.phpt b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
new file mode 100644
index 000000000..9de55aa3e
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_rename_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test compress.zlib:// scheme with the unlink function
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+rename($srcFile, 'something.tmp');
+var_dump(file_exists($inputFileName));
+?>
+===DONE===
+--EXPECTF--
+
+Warning: rename(): ZLIB wrapper does not support renaming in %s on line %d
+bool(true)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_stat_basic.phpt b/ext/zlib/tests/zlib_scheme_stat_basic.phpt
new file mode 100644
index 000000000..10cd9a4b0
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_stat_basic.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Test compress.zlib:// scheme with the unlink function
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+stat($srcFile);
+lstat($srcFile);
+?>
+===DONE===
+--EXPECTF--
+
+Warning: stat(): stat failed for compress.zlib://%s/004.txt.gz in %s on line %d
+
+Warning: lstat(): Lstat failed for compress.zlib://%s/004.txt.gz in %s on line %d
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_stat_basic2.phpt b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
new file mode 100644
index 000000000..e78bcd76c
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_stat_basic2.phpt
@@ -0,0 +1,46 @@
+--TEST--
+Test compress.zlib:// scheme with the unlink function
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+echo "file_exists=";
+var_dump(file_exists($srcFile));
+echo "is_file=";
+var_dump(is_file($srcFile));
+echo "is_dir=";
+var_dump(is_dir($srcFile));
+echo "is_readable=";
+var_dump(is_readable($srcFile));
+echo "\n";
+echo "filesize=";
+var_dump(filesize($srcFile));
+echo "filetype=";
+var_dump(filetype($srcFile));
+echo "fileatime=";
+var_dump(fileatime($srcFile));
+
+?>
+===DONE===
+--EXPECTF--
+file_exists=bool(false)
+is_file=bool(false)
+is_dir=bool(false)
+is_readable=bool(false)
+
+filesize=
+Warning: filesize(): stat failed for compress.zlib://%s004.txt.gz in %s on line %d
+bool(false)
+filetype=
+Warning: filetype(): Lstat failed for compress.zlib://%s004.txt.gz in %s on line %d
+bool(false)
+fileatime=
+Warning: fileatime(): stat failed for compress.zlib://%s004.txt.gz in %s on line %d
+bool(false)
+===DONE=== \ No newline at end of file
diff --git a/ext/zlib/tests/zlib_scheme_unlink_basic.phpt b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
new file mode 100644
index 000000000..b05e45bc6
--- /dev/null
+++ b/ext/zlib/tests/zlib_scheme_unlink_basic.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Test compress.zlib:// scheme with the unlink function
+--SKIPIF--
+<?php
+if (!extension_loaded("zlib")) {
+ print "skip - ZLIB extension not loaded";
+}
+?>
+--FILE--
+<?php
+$inputFileName = dirname(__FILE__)."/004.txt.gz";
+$srcFile = "compress.zlib://$inputFileName";
+unlink($srcFile);
+var_dump(file_exists($inputFileName));
+?>
+===DONE===
+--EXPECTF--
+
+Warning: unlink(): ZLIB does not allow unlinking in %s on line %d
+bool(true)
+===DONE=== \ 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 000000000..74ccc0dab
--- /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 000000000..9cefce4cb
--- /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_fstat_basic.phpt b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
new file mode 100644
index 000000000..41f957e80
--- /dev/null
+++ b/ext/zlib/tests/zlib_wrapper_fstat_basic.phpt
@@ -0,0 +1,19 @@
+--TEST--
+Test function fstat() on zlib wrapper
+--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(fstat($h));
+fclose($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 000000000..53b140ac5
--- /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 000000000..2f76b46d9
--- /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