diff options
author | Jani Taskinen <jani@php.net> | 2010-03-12 10:28:59 +0000 |
---|---|---|
committer | Jani Taskinen <jani@php.net> | 2010-03-12 10:28:59 +0000 |
commit | af49e58f5155383a440041c77cc1ecbaf507fde7 (patch) | |
tree | 01ffe64d6f78450fb828f73d0e1e59f3cc7c8c76 /ext/zlib/tests | |
parent | ea539c8b88c9278363b6de0b39446e4e8e043391 (diff) | |
download | php-git-af49e58f5155383a440041c77cc1ecbaf507fde7.tar.gz |
- Reverted r296062 and r296065
Diffstat (limited to 'ext/zlib/tests')
40 files changed, 79 insertions, 302 deletions
diff --git a/ext/zlib/tests/005.phpt b/ext/zlib/tests/005.phpt index fb3795dccb..84fc3b5f10 100644 --- a/ext/zlib/tests/005.phpt +++ b/ext/zlib/tests/005.phpt @@ -28,7 +28,7 @@ var_dump(gzuncompress("", 9)); var_dump(gzuncompress($data1)); var_dump(gzuncompress($data2)); -$data2[4] = 0; +$data2{4} = 0; var_dump(gzuncompress($data2)); echo "Done\n"; diff --git a/ext/zlib/tests/006.phpt b/ext/zlib/tests/006.phpt index 8c03ea068d..6a4e0f4e67 100644 --- a/ext/zlib/tests/006.phpt +++ b/ext/zlib/tests/006.phpt @@ -48,8 +48,6 @@ string(%d) "%a" Warning: gzinflate() expects at least 1 parameter, 0 given in %s on line %d NULL - -Warning: gzinflate(): data error in %s on line %d bool(false) Warning: gzinflate(): data error in %s on line %d diff --git a/ext/zlib/tests/007.phpt b/ext/zlib/tests/007.phpt index 09207a583e..ec37b99de6 100644 --- a/ext/zlib/tests/007.phpt +++ b/ext/zlib/tests/007.phpt @@ -11,8 +11,8 @@ var_dump(gzencode("", -10)); var_dump(gzencode("", 100)); var_dump(gzencode("", 1, 100)); -var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP)); -var_dump(gzencode("", 9, ZLIB_ENCODING_DEFLATE)); +var_dump(gzencode("", -1, 1)); +var_dump(gzencode("", 9, 2)); $string = "Light of my sun Light in this temple @@ -21,8 +21,8 @@ Lies in the darkness"; var_dump(gzencode($string, 9, 3)); -var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP)); -var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE)); +var_dump(gzencode($string, -1, 1)); +var_dump(gzencode($string, 9, 2)); echo "Done\n"; ?> @@ -33,18 +33,18 @@ NULL Warning: gzencode() expects at most 3 parameters, 4 given in %s on line %d NULL -Warning: gzencode(): compression level (-10) must be within -1..9 in %s on line %d +Warning: gzencode(): compression level(-10) must be within -1..9 in %s on line %d bool(false) -Warning: gzencode(): compression level (100) must be within -1..9 in %s on line %d +Warning: gzencode(): compression level(100) must be within -1..9 in %s on line %d bool(false) -Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d +Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d bool(false) string(%d) "%s" string(%d) "%s" -Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d +Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d bool(false) string(%d) "%s" string(%d) "%s" diff --git a/ext/zlib/tests/gzcompress_basic1.phpt b/ext/zlib/tests/gzcompress_basic1.phpt index 1506d0c1ee..dddeb1d55d 100644 --- a/ext/zlib/tests/gzcompress_basic1.phpt +++ b/ext/zlib/tests/gzcompress_basic1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -/* Prototype : string gzcompress(string data [, int level, [int encoding]]) +/* Prototype : string gzcompress(string data [, int level]) * Description: Gzip-compress a string * Source code: ext/zlib/zlib.c * Alias to functions: @@ -63,7 +63,7 @@ int(0) string(32) "c2e070f4320d1f674965eaab95b53d9c" int(0) -- Compression level 2 -- -string(32) "36922f486410d08209d0d0d21b26030e" +string(32) "400a53d19ca337727f8cd362f5cd3ee0" int(0) -- Compression level 3 -- string(32) "a441a2f5169bb303cd45b860a5a9dbf9" @@ -122,4 +122,4 @@ int(0) -- Testing with no specified compression level -- string(70) "789c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee6020087a509cb" -===Done=== +===Done===
\ No newline at end of file diff --git a/ext/zlib/tests/gzcompress_error1.phpt b/ext/zlib/tests/gzcompress_error1.phpt index 9db0a56fa1..7fa60b9003 100644 --- a/ext/zlib/tests/gzcompress_error1.phpt +++ b/ext/zlib/tests/gzcompress_error1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -/* Prototype : string gzcompress(string data [, int level, [int encoding]]) +/* Prototype : string gzcompress(string data [, int level]) * Description: Gzip-compress a string * Source code: ext/zlib/zlib.c * Alias to functions: @@ -28,30 +28,26 @@ var_dump( gzcompress() ); echo "\n-- Testing gzcompress() function with more than expected no. of arguments --\n"; $data = 'string_val'; $level = 2; -$encoding = ZLIB_ENCODING_RAW; $extra_arg = 10; -var_dump( gzcompress($data, $level, $encoding, $extra_arg) ); +var_dump( gzcompress($data, $level, $extra_arg) ); echo "\n-- Testing with incorrect compression level --\n"; $bad_level = 99; var_dump(gzcompress($data, $bad_level)); -echo "\n-- Testing with invalid encoding --\n"; -$data = 'string_val'; -$encoding = 99; -var_dump(gzcompress($data, $level, $encoding)); - -echo "\n-- Testing with incorrect parameters --\n"; - 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-- @@ -64,7 +60,7 @@ NULL -- Testing gzcompress() function with more than expected no. of arguments -- -Warning: gzcompress() expects at most 3 parameters, 4 given in %s on line %d +Warning: gzcompress() expects at most 2 parameters, 3 given in %s on line %d NULL -- Testing with incorrect compression level -- @@ -72,13 +68,11 @@ NULL Warning: gzcompress(): compression level (99) must be within -1..9 in %s on line %d bool(false) --- Testing with invalid encoding -- - -Warning: gzcompress(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE 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 -===Done=== + +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 index 7a8457c24f..04aac01085 100644 --- a/ext/zlib/tests/gzcompress_variation1.phpt +++ b/ext/zlib/tests/gzcompress_variation1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -/* Prototype : string gzcompress(string data [, int level, [int encoding]]) +/* Prototype : string gzcompress(string data [, int level]) * Description: Gzip-compress a string * Source code: ext/zlib/zlib.c * Alias to functions: @@ -18,6 +18,8 @@ include(dirname(__FILE__) . '/data.inc'); echo "*** Testing gzcompress() : variation ***\n"; + + echo "\n-- Testing multiple compression --\n"; $output = gzcompress($data); var_dump( md5($output)); @@ -31,4 +33,4 @@ var_dump(md5(gzcompress($output))); -- Testing multiple compression -- string(32) "764809aef15bb34cb73ad49ecb600d99" string(32) "eba942bc2061f23ea8688cc5101872a4" -===Done=== +===Done===
\ No newline at end of file diff --git a/ext/zlib/tests/gzdeflate_basic1.phpt b/ext/zlib/tests/gzdeflate_basic1.phpt index a2ae0f01da..823f320352 100644 --- a/ext/zlib/tests/gzdeflate_basic1.phpt +++ b/ext/zlib/tests/gzdeflate_basic1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -/* Prototype : string gzdeflate(string data [, int level, [int encoding]]) +/* Prototype : proto string gzdeflate(string data [, int level]) * Description: Gzip-compress a string * Source code: ext/zlib/zlib.c * Alias to functions: diff --git a/ext/zlib/tests/gzdeflate_error1.phpt b/ext/zlib/tests/gzdeflate_error1.phpt index 8abd5bec25..78491af9f1 100644 --- a/ext/zlib/tests/gzdeflate_error1.phpt +++ b/ext/zlib/tests/gzdeflate_error1.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -/* Prototype : string gzdeflate(string data [, int level, [int encoding]]) +/* Prototype : string gzdeflate(string data [, int level]) * Description: Gzip-compress a string * Source code: ext/zlib/zlib.c * Alias to functions: @@ -28,18 +28,13 @@ var_dump( gzdeflate() ); echo "\n-- Testing gzdeflate() function with more than expected no. of arguments --\n"; $data = 'string_val'; $level = 2; -$encoding = ZLIB_ENCODING_RAW; $extra_arg = 10; -var_dump( gzdeflate($data, $level, $encoding, $extra_arg) ); +var_dump( gzdeflate($data, $level, $extra_arg) ); echo "\n-- Testing with incorrect compression level --\n"; $bad_level = 99; var_dump(gzdeflate($data, $bad_level)); -echo "\n-- Testing with incorrect encoding --\n"; -$bad_encoding = 99; -var_dump(gzdeflate($data, $level, $bad_encoding)); - class Tester { function Hello() { echo "Hello\n"; @@ -63,7 +58,7 @@ NULL -- Testing gzdeflate() function with more than expected no. of arguments -- -Warning: gzdeflate() expects at most 3 parameters, 4 given in %s on line %d +Warning: gzdeflate() expects at most 2 parameters, 3 given in %s on line %d NULL -- Testing with incorrect compression level -- @@ -71,11 +66,6 @@ NULL Warning: gzdeflate(): compression level (99) must be within -1..9 in %s on line %d bool(false) --- Testing with incorrect encoding -- - -Warning: gzdeflate(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE 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 @@ -83,4 +73,4 @@ NULL Warning: gzdeflate() expects parameter 2 to be long, object given in %s on line %d NULL -===Done=== +===Done===
\ No newline at end of file diff --git a/ext/zlib/tests/gzdeflate_variation1.phpt b/ext/zlib/tests/gzdeflate_variation1.phpt index bc2453d78c..75eb16e03d 100644 --- a/ext/zlib/tests/gzdeflate_variation1.phpt +++ b/ext/zlib/tests/gzdeflate_variation1.phpt @@ -18,6 +18,8 @@ include(dirname(__FILE__) . '/data.inc'); echo "*** Testing gzdeflate() : variation ***\n"; + + echo "\n-- Testing multiple compression --\n"; $output = gzdeflate($data); var_dump( md5($output)); diff --git a/ext/zlib/tests/gzencode_basic1.phpt b/ext/zlib/tests/gzencode_basic1.phpt index 3c0ec559e9..9b3dcc8a38 100644 --- a/ext/zlib/tests/gzencode_basic1.phpt +++ b/ext/zlib/tests/gzencode_basic1.phpt @@ -51,13 +51,6 @@ for($i = -1; $i < 10; $i++) { var_dump(md5($output)); } -// Calling gzencode() with mandatory arguments -echo "\n-- Testing with no specified compression level --\n"; -var_dump(bin2hex(gzencode($smallstring))); - -echo "\n-- Testing gzencode with mode specified --\n"; -var_dump(bin2hex(gzencode($smallstring, -1, FORCE_GZIP))); - ?> ===Done=== --EXPECTF-- @@ -65,9 +58,9 @@ var_dump(bin2hex(gzencode($smallstring, -1, FORCE_GZIP))); -- Compression level -1 -- string(32) "d9ede02415ce91d21e5a94274e2b9c42" -- Compression level 0 -- -string(32) "bbf32d5508e5f1f4e6d42790489dae15" +string(32) "67aaf60426bb2cbd86d7fe530cb12306" -- Compression level 1 -- -string(32) "0bfaaa7a5a57f8fb533074fca6c85eeb" +string(32) "bce9c439cf767c1988ff4881b287d1ce" -- Compression level 2 -- string(32) "7ddbfed63a76c42808722b66f1c133fc" -- Compression level 3 -- @@ -83,13 +76,13 @@ string(32) "d9ede02415ce91d21e5a94274e2b9c42" -- Compression level 8 -- string(32) "d9ede02415ce91d21e5a94274e2b9c42" -- Compression level 9 -- -string(32) "0f220a09e9895bcb3a1308d2bc99cfdf" +string(32) "d9ede02415ce91d21e5a94274e2b9c42" -- Compression level -1 -- string(32) "f77bd31e1e4dd11d12828fb661a08010" -- Compression level 0 -- -string(32) "9c5005db88490d6fe102ea2c233b2872" +string(32) "36220d650930849b67e8e0622f9bf270" -- Compression level 1 -- -string(32) "d24ff7c4c20cef69b9c3abd603368db9" +string(32) "f77bd31e1e4dd11d12828fb661a08010" -- Compression level 2 -- string(32) "f77bd31e1e4dd11d12828fb661a08010" -- Compression level 3 -- @@ -105,11 +98,5 @@ string(32) "f77bd31e1e4dd11d12828fb661a08010" -- Compression level 8 -- string(32) "f77bd31e1e4dd11d12828fb661a08010" -- Compression level 9 -- -string(32) "8849e9a1543c04b3f882b5ce20839ed2" - --- Testing with no specified compression level -- -string(94) "1f8b08000000000000%c%c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200edc4e40b1b000000" - --- Testing gzencode with mode specified -- -string(94) "1f8b08000000000000%c%c735428ce4dccc951282e29cacc4b5728c95748cecf2d284a2d2ee60200edc4e40b1b000000" -===Done=== +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 index 9ecf4b8f08..ed8c977477 100644 --- a/ext/zlib/tests/gzencode_error1.phpt +++ b/ext/zlib/tests/gzencode_error1.phpt @@ -71,12 +71,12 @@ NULL -- Testing with incorrect compression level -- -Warning: gzencode(): compression level (99) must be within -1..9 in %s on line %d +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 either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d +Warning: gzencode(): encoding mode must be FORCE_GZIP or FORCE_DEFLATE in %s on line %d bool(false) -- Testing with incorrect parameters -- @@ -87,7 +87,7 @@ NULL Warning: gzencode() expects parameter 2 to be long, object given in %s on line %d NULL -Warning: gzencode(): encoding mode must be either ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d +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 @@ -95,4 +95,4 @@ NULL Warning: gzencode() expects parameter 2 to be long, string given in %s on line %d NULL -===Done=== +===Done===
\ No newline at end of file diff --git a/ext/zlib/tests/gzencode_variation1.phpt b/ext/zlib/tests/gzencode_variation1.phpt index ef1d3a77f7..47e2097f5f 100644 --- a/ext/zlib/tests/gzencode_variation1.phpt +++ b/ext/zlib/tests/gzencode_variation1.phpt @@ -3,10 +3,6 @@ Test gzencode() function : variation --SKIPIF-- <?php -if( substr(PHP_OS, 0, 3) == "WIN" ) { - die("skip.. Do not run on Windows"); -} - if (!extension_loaded("zlib")) { print "skip - ZLIB extension not loaded"; } @@ -34,4 +30,4 @@ var_dump(bin2hex(gzencode($output))); -- Testing multiple compression -- string(3658) "1f8b0800000000000003010e07f1f81f8b08000000000000036d574d6fe4c80dbdeb57d4ad2f3dfe01eb83e1ec22980e309b4562c067b64449159754dafab0b6e7d7e73d96da1e4c72184c4b2ab2c8f7c847fa25baabba98dc1a8b2b7c38bb324b713ee37f757f56cdc5c7f5b17b9d152f923b157c5ae335e0b75fedd0e2d781c6b98ea3a6ee05affe1dfc3a6527f8f09c52dcb38ba38bb5249934d6ecfe1e53a9ab76ff4c342cf2a64ed2028349fc9a8b139755685352acb82b9fbb67f8bade5cdcb698e1fcec94b7ceba3cb897e806cfc8114350dd1ebbdfa35b62d2478b0056d23ed809b9b95d696d91ce2aa97c911e3fa539c43f84c887554a4d125c9e63ff96711cc08c0866263cb37a0bbe2122ae8f6baecb2284abfb4ddf916db8354cddeef37c1afe5fa02fc7afb3db34f5b3acbdf2eb905490d8f38d7468d253a323d5ebb903760d7944d3b2024e834a99ddce77669bdd823cfbb8e899d4ad4c799677452e6029e80023a03b2374005590641f7d3877df2ad09f3c0e82a54d6a5644fd63049a37ed4bc362016fd9f51264f1e5c630727421ae930b7ed416e93e47b7c71a400390361ffbecb7561bb98f69b5da289e91becc27f08b3b724cb8704f9144d366431d0cb870c56b205deaa2e17636063761a911039fb7e4bf9f06c4f0aecd2ec80e8b41831ca7515e31286166458ea3ef71f2ce7cde2ae269c96d60525724a9c9170b713ed5750758f3cd2a361fc8b288fc92358ce884692e8ea0fe59bd969a0da2eed5831b715749eaae7178f3ebd30fb88c92105f367cce2c882955dc6bf8eca0d5d57540b3092894743ba0fd5b2dad021836191f1afc0bba14dde1642cb0b1aa6879c38907dcefa0720082b801bec61417469219175267dfa047df35b0bd1332001c28cdfafd3bcabe91e74368cdd8d8478e494c190e7ee90c67f2bde288e68ab6b15e883c995be4f8feb6c6dda4278e4f38578ddbdc7be36788daf0c3cb1d1819c73822f7000a0d1813fa94153b572315e51343b536bc64977dff163cebfd8418773261f524017e251fccc60ae29a5770ae097594d52e9c1229d87ce967a36401c46b69945afb249d101c9d420ffa9a123e232c20e76467d5d169202a2dd4c582949e013e745df7958d4b0cc4fd4377a737cd4feea7974070000f314d423e0634cb9a618fdf5dc64fd422181fd59c9230c9f6f9d18dc8fc23e9cccbc7188733b04aa57de83ebea0be3633cff5fa1ff83269be7f44f5a8d84550cc703255fd345dd402034d0b3e11a73ec6e3d4a77f4f685b614329f1b3132ae7af33d02e1e55e291fa6574b758d1f0200e7423dbc852211818043a7c9ce80aa9d59fce0401959f5ea2cf71fde90824f8c9192dbe9d329db143794675ddcf257dd7755273b67340414e3ccad12e3f661f8aad9cf9957dc1275d10a51d3934fa81e68dc6768fb8ee23e373936c8e13feab8b0f50d227f7af76f561fb0950f3d099bbc316c3892a42fb36806d8660e800fa4f43fd4b962d2097d71933a54b77ff948677848eb17bb3a88b621682cfb3bbb49cf42fed6b3944124ad8358ca688aa44dd5f2144c7c9ab16f25b9aca9654ef357ec9ad55c40d324d6cc3d9e3920b863c231d31a95d937fb5520f9c816c79b7dcecc593fb9593cc05a51ebb1eeddd5b49eb437769738d0f64adc579d372b8b7f7c0208487ee3915ebf5766e148ebd77cf4e01f3ec285047011e55838968b6494d517fe29224777b24dd3ddf933101695b102e87db805eef291b74dcfd91628fb2a53f93dbd2968ef2e598746c9204f89fba1f0246fc671610a0591806e46a1346f77c40d910a47c5e20ffb23f003c04b648327a4ed98032c1965bd35bb0044f5344248f56fdb99aa61d6451d68e33489a83bffbe6573541b2da5f64681ea12090f778b2075374778810f73965fa3626a9d41f4df2f83f7c34658cec921b5a9bde49dd5007ec882b02adc514f81aa85898b5cc98e1b137733c0a8789b7f5648d2d231b80bf74978f25d61ce08a8abd11801fd8f995e066676307192ff7641f1cc6e0dee68565b8b22ac3889cd067bf732754a6b270af1044c6a8776811a4f6d8bd0477a9f516064201b920b92d7cd4dc7eee13e6b3eb3528a82f9abb3f388ebe6a8f871393461b73816ec54c99d604174bc5a6801de13908f86aea6a7d0fea107d682bcf1ec348b83872e6b8a316ecd02eb8f8dc86a609bf59a2dd03f1dfa4079436d55e24617be1a2854d008b2b2b1705e2078a7f3946318df1c24f6bf70d4b456eca286ec2b585b28262cc048a098c3e2d5f325a92bb36f691afdc14c822da1b116c9c1c07bb362eb0a04b78834c812134230ebf2044ac2e3c0e3ad00f848dc5010f3bf917ec2fc700b7bf26dacea8440620e04f90f4d97d6dd77cfde8a05c7d3930f1e5811fb8ec5c70964dcc8187ec90e32fdd6b64eec7586413b7d55bed65c4cce39a9b6c15e70e9da94e53fc904e6286f01f5b5562c94211befbc23507e01b2a3865e2f45b5d7b591f290087a5605b82495b4e393f31aa5b37211ec40241a746d903c5eebf117a4d3ddb0d00007b64cbc70e070000" -===Done=== +===Done===
\ No newline at end of file diff --git a/ext/zlib/tests/gzencode_variation2-win32.phpt b/ext/zlib/tests/gzencode_variation2-win32.phpt deleted file mode 100644 index f664359e2a..0000000000 --- a/ext/zlib/tests/gzencode_variation2-win32.phpt +++ /dev/null @@ -1,42 +0,0 @@ ---TEST-- -Test gzencode() function : variation - verify header contents with all encoding modes ---XFAIL-- -Test will fail until bug #47178 resolved; missing gzip headers whne FORCE_DEFLATE specified ---SKIPIF-- -<?php - -if( substr(PHP_OS, 0, 3) != "WIN" ) { - die("skip.. only for Windows"); -} - -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) "1f8b080000000000000b735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" -string(90) "1f8b080000000000000b735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" -string(86) "1f8b080000000000000b789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd" -===DONE=== diff --git a/ext/zlib/tests/gzencode_variation2.phpt b/ext/zlib/tests/gzencode_variation2.phpt index e6fe7dd65c..901cd53c19 100644 --- a/ext/zlib/tests/gzencode_variation2.phpt +++ b/ext/zlib/tests/gzencode_variation2.phpt @@ -1,14 +1,8 @@ --TEST-- Test gzencode() function : variation - verify header contents with all encoding modes ---XFAIL-- -Test will fail until bug #47178 resolved; missing gzip headers whne FORCE_DEFLATE specified --SKIPIF-- <?php -if( substr(PHP_OS, 0, 3) == "WIN" ) { - die("skip.. Do not run on Windows"); -} - if (!extension_loaded("zlib")) { print "skip - ZLIB extension not loaded"; } @@ -39,4 +33,4 @@ var_dump(bin2hex(gzencode($data, -1, FORCE_DEFLATE))); string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" string(90) "1f8b0800000000000003735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200d7739de519000000" string(86) "1f8b0800000000000003789c735428ce4dccc951282e29cacc4b5728c95748cd4bce4f49e50200735808cd" -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/gzfile_variation10.phpt b/ext/zlib/tests/gzfile_variation10.phpt index 71d0ca82d2..2a6d8915d0 100644 --- a/ext/zlib/tests/gzfile_variation10.phpt +++ b/ext/zlib/tests/gzfile_variation10.phpt @@ -116,4 +116,4 @@ array(6) { string(39) "and I know that it descends down on me " } -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/gzfilegzreadfile.phpt b/ext/zlib/tests/gzfilegzreadfile.phpt index b6cc5f97e9..2d6843ddd4 100644 --- a/ext/zlib/tests/gzfilegzreadfile.phpt +++ b/ext/zlib/tests/gzfilegzreadfile.phpt @@ -5,7 +5,7 @@ gzfile(), gzreadfile() if (!extension_loaded("zlib")) print "skip"; ?> --FILE-- <?php -$original = b<<<EOD +$original = <<<EOD blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah diff --git a/ext/zlib/tests/gzinflate-bug42663.phpt b/ext/zlib/tests/gzinflate-bug42663.phpt index 4f0ca9fa7f..dd53c78f4e 100644 --- a/ext/zlib/tests/gzinflate-bug42663.phpt +++ b/ext/zlib/tests/gzinflate-bug42663.phpt @@ -5,8 +5,8 @@ Bug #42663 (gzinflate() try to allocate all memory with truncated $data) --FILE-- <?php // build a predictable string -$string = ''; -for($i=0; $i<30000; ++$i) $string .= $i . ' '; +$string = b''; +for($i=0; $i<30000; ++$i) $string .= (binary)$i . b' '; var_dump(strlen($string)); // deflate string $deflated = gzdeflate($string,9); @@ -15,12 +15,9 @@ var_dump(strlen($deflated)); $truncated = substr($deflated, 0, 65535); var_dump(strlen($truncated)); // inflate $truncated string (check if it will not eat all memory) -var_dump(gzinflate($truncated)); +gzinflate($truncated); ?> ---EXPECTF-- +--EXPECT-- int(168890) int(66743) int(65535) - -Warning: gzinflate(): data error in %s on line %d -bool(false) diff --git a/ext/zlib/tests/gzinflate_length.phpt b/ext/zlib/tests/gzinflate_length.phpt index 6e86d865ee..436025d13a 100644 --- a/ext/zlib/tests/gzinflate_length.phpt +++ b/ext/zlib/tests/gzinflate_length.phpt @@ -4,7 +4,7 @@ gzinflate() and $length argument <?php if (!extension_loaded("zlib")) print "skip"; ?> --FILE-- <?php -$original = 'aaaaaaaaaaaaaaa'; +$original = b'aaaaaaaaaaaaaaa'; $packed=gzdeflate($original); echo strlen($packed)." ".strlen($original)."\n"; $unpacked=gzinflate($packed, strlen($original)); diff --git a/ext/zlib/tests/gzopen_variation5.phpt b/ext/zlib/tests/gzopen_variation5.phpt index e7562e044e..de505f7216 100644 --- a/ext/zlib/tests/gzopen_variation5.phpt +++ b/ext/zlib/tests/gzopen_variation5.phpt @@ -36,7 +36,7 @@ rmdir($thisTestDir); function runtest() { $tmpfile = 'gzopen_variation5.tmp'; $h = gzopen($tmpfile, "w", true); - fwrite($h, b"This is the test file"); + fwrite($h, "This is the test file"); fclose($h); diff --git a/ext/zlib/tests/gzopen_variation8.phpt b/ext/zlib/tests/gzopen_variation8.phpt index e7c83701a4..bb0126227f 100644 --- a/ext/zlib/tests/gzopen_variation8.phpt +++ b/ext/zlib/tests/gzopen_variation8.phpt @@ -16,7 +16,7 @@ if (!extension_loaded("zlib")) { echo "*** Testing gzopen() : variation ***\n"; -$data = b<<<EOT +$data = <<<EOT Here is some plain text to be read and displayed. diff --git a/ext/zlib/tests/gzread_variation1.phpt b/ext/zlib/tests/gzread_variation1.phpt index dd0097f286..1f50d77126 100644 --- a/ext/zlib/tests/gzread_variation1.phpt +++ b/ext/zlib/tests/gzread_variation1.phpt @@ -11,7 +11,7 @@ if (!extension_loaded("zlib")) { $filename = "temp.txt.gz"; $h = gzopen($filename, 'w'); -$str = b"Here is the string to be written. "; +$str = "Here is the string to be written. "; var_dump(gzread($h, 100)); gzwrite( $h, $str); var_dump(gzread($h, 100)); diff --git a/ext/zlib/tests/gzreadgzwrite.phpt b/ext/zlib/tests/gzreadgzwrite.phpt index 71d728b6ed..6d6729a72f 100644 --- a/ext/zlib/tests/gzreadgzwrite.phpt +++ b/ext/zlib/tests/gzreadgzwrite.phpt @@ -5,7 +5,7 @@ gzopen(), gzread(), gzwrite() if (!extension_loaded("zlib")) print "skip"; ?> --FILE-- <?php -$original = str_repeat(b"hallo php",4096); +$original = str_repeat("hallo php",4096); $filename = tempnam("/tmp", "phpt"); $fp = gzopen($filename, "wb"); @@ -15,12 +15,7 @@ var_dump(gztell($fp)); fclose($fp); $fp = gzopen($filename, "rb"); - -$data = ''; -while ($buf = gzread($fp, 8092)) { - $data .= $buf; -} - +$data = gzread($fp, strlen($original)); if ($data == $original) { echo "Strings are equal\n"; } else { diff --git a/ext/zlib/tests/gzreadgzwriteplain.phpt b/ext/zlib/tests/gzreadgzwriteplain.phpt index 6a752b6212..7bb567d889 100644 --- a/ext/zlib/tests/gzreadgzwriteplain.phpt +++ b/ext/zlib/tests/gzreadgzwriteplain.phpt @@ -5,7 +5,7 @@ gzopen(), gzread(), gzwrite() for non-compressed data if (!extension_loaded("zlib")) print "skip"; ?> --FILE-- <?php -$original = str_repeat(b"hallo php",4096); +$original = str_repeat("hallo php",4096); $filename = tempnam("/tmp", "phpt"); $fp = fopen($filename, "wb"); @@ -15,12 +15,7 @@ var_dump(ftell($fp)); fclose($fp); $fp = gzopen($filename, "rb"); - -$data = ''; -while ($buf = gzread($fp, 8192)) { - $data .= $buf; -} - +$data = gzread($fp, strlen($original)); if ($data == $original) { echo "Strings are equal\n"; } else { @@ -29,11 +24,7 @@ if ($data == $original) { } gzseek($fp, strlen($original) / 2); - -$data = ''; -while ($buf = gzread($fp, 8192)) { - $data .= $buf; -} +$data = gzread($fp, strlen($original)); var_dump(strlen($data)); if ($data == substr($original, strlen($original) / 2)) { diff --git a/ext/zlib/tests/gzuncompress_basic1.phpt b/ext/zlib/tests/gzuncompress_basic1.phpt index 203a375a06..fa7f1759e6 100644 --- a/ext/zlib/tests/gzuncompress_basic1.phpt +++ b/ext/zlib/tests/gzuncompress_basic1.phpt @@ -27,7 +27,7 @@ var_dump(strcmp($data, gzuncompress($compressed))); $length = 3547; -echo "\n-- Calling gzuncompress() with all max length of $length --\n"; +echo "\n-- Calling gzuncompress() with max length of $length --\n"; echo "Result length is ". strlen(gzuncompress($compressed, $length)) . "\n"; ?> @@ -38,6 +38,6 @@ echo "Result length is ". strlen(gzuncompress($compressed, $length)) . "\n"; -- Basic decompress -- int(0) --- Calling gzuncompress() with all max length of 3547 -- +-- Calling gzuncompress() with max length of 3547 -- Result length is 3547 -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/gzuncompress_error1.phpt b/ext/zlib/tests/gzuncompress_error1.phpt index f26a4f5dcd..66e5b2ac43 100644 --- a/ext/zlib/tests/gzuncompress_error1.phpt +++ b/ext/zlib/tests/gzuncompress_error1.phpt @@ -14,6 +14,8 @@ if (!extension_loaded("zlib")) { * Alias to functions: */ + + echo "*** Testing gzuncompress() : error conditions ***\n"; // Zero arguments @@ -27,12 +29,14 @@ $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)); @@ -64,7 +68,7 @@ NULL -- Testing with a buffer that is too small -- -Warning: gzuncompress(): insufficient memory in %s on line %d +Warning: gzuncompress(): buffer error in %s on line %d bool(false) -- Testing with incorrect arguments -- @@ -77,4 +81,4 @@ NULL Warning: gzuncompress() expects parameter 2 to be long, string given in %s on line %d NULL -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/gzwrite_basic.phpt b/ext/zlib/tests/gzwrite_basic.phpt index 4f76f32cd0..0d7521625d 100644 --- a/ext/zlib/tests/gzwrite_basic.phpt +++ b/ext/zlib/tests/gzwrite_basic.phpt @@ -11,7 +11,7 @@ if (!extension_loaded("zlib")) { $filename = "temp.txt.gz"; $h = gzopen($filename, 'w'); -$str = b"Here is the string to be written. "; +$str = "Here is the string to be written. "; $length = 10; var_dump(gzwrite( $h, $str ) ); var_dump(gzwrite( $h, $str, $length ) ); diff --git a/ext/zlib/tests/gzwrite_variation1.phpt b/ext/zlib/tests/gzwrite_variation1.phpt index ab6c2606b4..bd3778e366 100644 --- a/ext/zlib/tests/gzwrite_variation1.phpt +++ b/ext/zlib/tests/gzwrite_variation1.phpt @@ -11,7 +11,7 @@ if (!extension_loaded("zlib")) { $filename = dirname(__FILE__)."/004.txt.gz"; $h = gzopen($filename, 'r'); -$str = b"Here is the string to be written. "; +$str = "Here is the string to be written. "; $length = 10; var_dump(gzwrite( $h, $str ) ); var_dump(gzread($h, 10)); diff --git a/ext/zlib/tests/ob_001.phpt b/ext/zlib/tests/ob_001.phpt deleted file mode 100644 index 0b3cd1069d..0000000000 --- a/ext/zlib/tests/ob_001.phpt +++ /dev/null @@ -1,19 +0,0 @@ ---TEST-- -zlib.output_compression ---SKIPIF-- -<?php -if (!extension_loaded("zlib")) die("skip need ext/zlib"); -if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); -?> ---GET-- -a=b ---INI-- -zlib.output_compression=1 ---ENV-- -HTTP_ACCEPT_ENCODING=gzip ---FILE-- -<?php -echo "hi\n"; -?> ---EXPECTF-- -‹%s diff --git a/ext/zlib/tests/ob_002.phpt b/ext/zlib/tests/ob_002.phpt deleted file mode 100644 index 5601440eb8..0000000000 --- a/ext/zlib/tests/ob_002.phpt +++ /dev/null @@ -1,17 +0,0 @@ ---TEST-- -zlib.output_compression ---SKIPIF-- -<?php -if (!extension_loaded("zlib")) die("skip need ext/zlib"); -?> ---INI-- -zlib.output_compression=1 ---ENV-- -HTTP_ACCEPT_ENCODING=gzip ---FILE-- -<?php -ini_set("zlib.output_compression", 0); -echo "hi\n"; -?> ---EXPECTF-- -hi diff --git a/ext/zlib/tests/ob_003.phpt b/ext/zlib/tests/ob_003.phpt deleted file mode 100644 index 43dbb08969..0000000000 --- a/ext/zlib/tests/ob_003.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -zlib.output_compression ---SKIPIF-- -<?php -if (!extension_loaded("zlib")) die("skip need ext/zlib"); -if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); -?> ---INI-- -zlib.output_compression=0 ---ENV-- -HTTP_ACCEPT_ENCODING=gzip ---POST-- -dummy=42 ---FILE-- -<?php -ini_set("zlib.output_compression", 1); -echo "hi\n"; -?> ---EXPECTF-- -%s -Content-Encoding: gzip -Vary: Accept-Encoding -%s - -‹%s diff --git a/ext/zlib/tests/ob_004.phpt b/ext/zlib/tests/ob_004.phpt deleted file mode 100644 index 3d3be9df7b..0000000000 --- a/ext/zlib/tests/ob_004.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -ob_gzhandler ---SKIPIF-- -<?php -if (!extension_loaded("zlib")) die("skip need ext/zlib"); -if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); -?> ---INI-- -zlib.output_compression=0 ---ENV-- -HTTP_ACCEPT_ENCODING=gzip ---POST-- -dummy=42 ---FILE-- -<?php -ob_start("ob_gzhandler"); -echo "hi\n"; -?> ---EXPECTF-- -%s -Content-Encoding: gzip -Vary: Accept-Encoding -%s - -‹%s diff --git a/ext/zlib/tests/ob_005.phpt b/ext/zlib/tests/ob_005.phpt deleted file mode 100644 index c266cb71f3..0000000000 --- a/ext/zlib/tests/ob_005.phpt +++ /dev/null @@ -1,21 +0,0 @@ ---TEST-- -ob_gzhandler ---SKIPIF-- -<?php -if (!extension_loaded("zlib")) die("skip need ext/zlib"); -if (false === stristr(PHP_SAPI, "cgi")) die("skip need sapi/cgi"); -?> ---INI-- -zlib.output_compression=0 ---ENV-- -HTTP_ACCEPT_ENCODING=gzip ---POST-- -dummy=42 ---FILE-- -<?php -ob_start("ob_gzhandler"); -ini_set("zlib.output_compression", 0); -echo "hi\n"; -?> ---EXPECTF-- -%shi diff --git a/ext/zlib/tests/readgzfile_variation10.phpt b/ext/zlib/tests/readgzfile_variation10.phpt index 7b4c2c77fc..29249a1f2b 100644 --- a/ext/zlib/tests/readgzfile_variation10.phpt +++ b/ext/zlib/tests/readgzfile_variation10.phpt @@ -64,4 +64,4 @@ Destiny who cares as it turns around and I know that it descends down on me int(176) -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/readgzfile_variation14.phpt b/ext/zlib/tests/readgzfile_variation14.phpt index ee0d6d6d4e..165bf59b89 100644 --- a/ext/zlib/tests/readgzfile_variation14.phpt +++ b/ext/zlib/tests/readgzfile_variation14.phpt @@ -41,4 +41,4 @@ NULL Warning: readgzfile() expects parameter 2 to be long, string given in %s on line %d NULL -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/readgzfile_variation4.phpt b/ext/zlib/tests/readgzfile_variation4.phpt index ece84a990e..cbc561c71d 100644 --- a/ext/zlib/tests/readgzfile_variation4.phpt +++ b/ext/zlib/tests/readgzfile_variation4.phpt @@ -26,18 +26,9 @@ foreach ( $variation as $var ) { ?> ===DONE=== --EXPECTF-- -Warning: readgzfile(10.5): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(-10.5): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(123456789000): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(-123456789000): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(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/readgzfile_variation5.phpt b/ext/zlib/tests/readgzfile_variation5.phpt index 460e188930..dde0dabdd0 100644 --- a/ext/zlib/tests/readgzfile_variation5.phpt +++ b/ext/zlib/tests/readgzfile_variation5.phpt @@ -25,15 +25,8 @@ foreach ( $variation as $var ) { ?> ===DONE=== --EXPECTF-- -Warning: readgzfile(0): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(1): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(12345): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(-2345): failed to open stream: No such file or directory in %s on line %d bool(false) -===DONE=== +===DONE===
\ No newline at end of file diff --git a/ext/zlib/tests/readgzfile_variation6.phpt b/ext/zlib/tests/readgzfile_variation6.phpt index 69a4dc190a..1beeca764b 100644 --- a/ext/zlib/tests/readgzfile_variation6.phpt +++ b/ext/zlib/tests/readgzfile_variation6.phpt @@ -43,7 +43,6 @@ foreach ( $variation as $var ) { } ?> --EXPECTF-- -Error: 2 - readgzfile(Class A object): failed to open stream: No such file or directory, %s(%d) 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 index 20162b5cb5..df244d3954 100644 --- a/ext/zlib/tests/readgzfile_variation7.phpt +++ b/ext/zlib/tests/readgzfile_variation7.phpt @@ -29,15 +29,8 @@ foreach ( $variation_array as $var ) { ?> ===DONE=== --EXPECTF-- -Warning: readgzfile(string): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(string): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(sTrInG): failed to open stream: No such file or directory in %s on line %d bool(false) - -Warning: readgzfile(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/zlib_filter_inflate2.phpt b/ext/zlib/tests/zlib_filter_inflate2.phpt index a2099b6f7a..4332d8e5e6 100644 --- a/ext/zlib/tests/zlib_filter_inflate2.phpt +++ b/ext/zlib/tests/zlib_filter_inflate2.phpt @@ -6,7 +6,7 @@ zlib.inflate of gzip-encoded stream <?php /* $Id$ */ $a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w'); -fwrite($a, b"This is quite the thing ain't it\n"); +fwrite($a, "This is quite the thing ain't it\n"); fclose($a); $fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r'); @@ -38,4 +38,4 @@ fclose($fp); 2 This is quite the thing ain't it 3 -This is quite the thing ain't it +This is quite the thing ain't it
\ 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 index 576de944ce..0b56ec430a 100644 --- a/ext/zlib/tests/zlib_scheme_copy_variation2.phpt +++ b/ext/zlib/tests/zlib_scheme_copy_variation2.phpt @@ -8,7 +8,7 @@ if (!extension_loaded("zlib")) { ?> --FILE-- <?php -$org_data = b<<<EOT +$org_data = <<<EOT uncompressed contents of 004.txt.gz is: When you're taught through feelings Destiny flying high above |