summaryrefslogtreecommitdiff
path: root/ext/zlib
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
commit2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch)
tree41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/zlib
parentd29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff)
downloadphp-2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b.tar.gz
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/zlib')
-rw-r--r--ext/zlib/package.xml2
-rw-r--r--ext/zlib/php_zlib.def76
-rw-r--r--ext/zlib/php_zlib.h4
-rw-r--r--ext/zlib/tests/bug_34821.phpt20
-rw-r--r--ext/zlib/zlib.c4
-rw-r--r--ext/zlib/zlib_filter.c14
-rw-r--r--ext/zlib/zlib_fopen_wrapper.c6
7 files changed, 89 insertions, 37 deletions
diff --git a/ext/zlib/package.xml b/ext/zlib/package.xml
index 197357b89..4be42e093 100644
--- a/ext/zlib/package.xml
+++ b/ext/zlib/package.xml
@@ -41,7 +41,7 @@ files (and uncompressed files, too, but not with sockets).
<version>5.0.0rc1</version>
<date>2004-03-19</date>
<notes>
-package.xml added to support intallation using pear installer
+package.xml added to support installation using pear installer
</notes>
<filelist>
<file role="doc" name="CREDITS"/>
diff --git a/ext/zlib/php_zlib.def b/ext/zlib/php_zlib.def
index c0ff0dae5..a47cbc10c 100644
--- a/ext/zlib/php_zlib.def
+++ b/ext/zlib/php_zlib.def
@@ -1,18 +1,60 @@
+LIBRARY
+; zlib data compression library
+
EXPORTS
- compress
- compress2
- deflate
- deflateEnd
- deflateInit_
- deflateInit2_
- uncompress
- inflateInit_
- inflateInit2_
- inflate
- inflateEnd
- crc32
- inflateReset
- deflateReset
- zlibVersion
- zError
- \ No newline at end of file
+; basic functions
+ zlibVersion
+ deflate
+ deflateEnd
+ inflate
+ inflateEnd
+; advanced functions
+ deflateSetDictionary
+ deflateCopy
+ deflateReset
+ deflateParams
+ deflateBound
+ deflatePrime
+ inflateSetDictionary
+ inflateSync
+ inflateCopy
+ inflateReset
+ inflateBack
+ inflateBackEnd
+ zlibCompileFlags
+; utility functions
+ compress
+ compress2
+ compressBound
+ uncompress
+ gzopen
+ gzdopen
+ gzsetparams
+ gzread
+ gzwrite
+ gzprintf
+ gzputs
+ gzgets
+ gzputc
+ gzgetc
+ gzungetc
+ gzflush
+ gzseek
+ gzrewind
+ gztell
+ gzeof
+ gzclose
+ gzerror
+ gzclearerr
+; checksum functions
+ adler32
+ crc32
+; various hacks, don't look :)
+ deflateInit_
+ deflateInit2_
+ inflateInit_
+ inflateInit2_
+ inflateBackInit_
+ inflateSyncPoint
+ get_crc_table
+ zError
diff --git a/ext/zlib/php_zlib.h b/ext/zlib/php_zlib.h
index dc0bc727d..047b73f3f 100644
--- a/ext/zlib/php_zlib.h
+++ b/ext/zlib/php_zlib.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_zlib.h,v 1.42.2.1.2.1 2006/08/14 20:08:18 nlopess Exp $ */
+/* $Id: php_zlib.h,v 1.42.2.1.2.2 2007/01/01 09:36:10 sebastian Exp $ */
#ifndef PHP_ZLIB_H
#define PHP_ZLIB_H
diff --git a/ext/zlib/tests/bug_34821.phpt b/ext/zlib/tests/bug_34821.phpt
index ff845c6df..b378ec409 100644
--- a/ext/zlib/tests/bug_34821.phpt
+++ b/ext/zlib/tests/bug_34821.phpt
@@ -1,29 +1,29 @@
--TEST--
-bug 34821
+Bug #34821 (zlib encoders fail on widely varying binary data)
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php
-// test 50 bytes to 500k
+// test 50 bytes to 50k
$b = array(
50,
500,
5000,
- 500000,
+ 50000,
// 1000000, // works, but test would take too long
);
-srand(time());
+$s = '';
+$i = 0;
foreach ($b as $size) {
- $s = '';
- for ($i = 0; $i <= $size; ++$i) {
+ do {
$s .= chr(rand(0,255));
- }
- var_dump($s == gzinflate(gzdeflate($s)));
- var_dump($s == gzuncompress(gzcompress($s)));
- var_dump($s == gzinflate(substr(gzencode($s), 10, -8)));
+ } while (++$i < $size);
+ var_dump($s === gzinflate(gzdeflate($s)));
+ var_dump($s === gzuncompress(gzcompress($s)));
+ var_dump($s === gzinflate(substr(gzencode($s), 10, -8)));
}
?>
--EXPECT--
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index 46918a0f8..2df9aaae3 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.183.2.6.2.4 2006/08/14 20:08:18 nlopess Exp $ */
+/* $Id: zlib.c,v 1.183.2.6.2.5 2007/01/01 09:36:10 sebastian Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index cd80babfb..fd3e19c7a 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_filter.c,v 1.6.2.2.2.2 2006/10/16 15:39:39 iliaa Exp $ */
+/* $Id: zlib_filter.c,v 1.6.2.2.2.4 2007/01/25 12:22:21 tony2001 Exp $ */
#include "php.h"
#include "php_zlib.h"
@@ -100,6 +100,11 @@ static php_stream_filter_status_t php_zlib_inflate_filter(
consumed += desired;
bin += desired;
+ if (!desired) {
+ flags |= PSFS_FLAG_FLUSH_CLOSE;
+ break;
+ }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
@@ -208,6 +213,11 @@ static php_stream_filter_status_t php_zlib_deflate_filter(
consumed += desired;
bin += desired;
+ if (!desired) {
+ flags |= PSFS_FLAG_FLUSH_CLOSE;
+ break;
+ }
+
if (data->strm.avail_out < data->outbuf_len) {
php_stream_bucket *out_bucket;
size_t bucketlen = data->outbuf_len - data->strm.avail_out;
diff --git a/ext/zlib/zlib_fopen_wrapper.c b/ext/zlib/zlib_fopen_wrapper.c
index 5d811679b..1864e9d32 100644
--- a/ext/zlib/zlib_fopen_wrapper.c
+++ b/ext/zlib/zlib_fopen_wrapper.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.1 2006/08/14 20:08:18 nlopess Exp $ */
+/* $Id: zlib_fopen_wrapper.c,v 1.46.2.1.2.3 2007/04/26 12:52:58 dmitry Exp $ */
#define _GNU_SOURCE
@@ -76,7 +76,7 @@ static int php_gziop_close(php_stream *stream, int close_handle TSRMLS_DC)
self->gz_file = NULL;
}
if (self->stream) {
- php_stream_close(self->stream);
+ php_stream_free(self->stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_PRESERVE_HANDLE);
self->stream = NULL;
}
}