cellog          Wed Jan  9 06:45:15 2008 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/zlib/tests     zlib_filter_inflate2.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/zlib   zlib_filter.c 
  Log:
  fix Bug #43793: zlib filter is unable to auto-detect gzip/zlib file headers
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1048&r2=1.2027.2.547.2.1049&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1048 php-src/NEWS:1.2027.2.547.2.1049
--- php-src/NEWS:1.2027.2.547.2.1048    Tue Jan  8 19:10:16 2008
+++ php-src/NEWS        Wed Jan  9 06:45:15 2008
@@ -5,6 +5,8 @@
 - Fixed a safe_mode bypass in cURL identified by Maksymilian Arciemowicz.
   (Ilia)
 
+- Fixed bug #43793 (zlib filter is unable to auto-detect gzip/zlib file 
headers).
+  (Greg)
 - Fixed bug #43663 (Extending PDO class with a __call() function doesn't 
work). 
   (David Soria Parra)
 - Fixed bug #43647 (Make FindFile use PATH_SEPARATOR instead of ";"). (Ilia)
http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/zlib_filter.c?r1=1.6.2.2.2.5&r2=1.6.2.2.2.6&diff_format=u
Index: php-src/ext/zlib/zlib_filter.c
diff -u php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.5 
php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.6
--- php-src/ext/zlib/zlib_filter.c:1.6.2.2.2.5  Mon Dec 31 07:20:14 2007
+++ php-src/ext/zlib/zlib_filter.c      Wed Jan  9 06:45:15 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zlib_filter.c,v 1.6.2.2.2.5 2007/12/31 07:20:14 sebastian Exp $ */
+/* $Id: zlib_filter.c,v 1.6.2.2.2.6 2008/01/09 06:45:15 cellog Exp $ */
 
 #include "php.h"
 #include "php_zlib.h"
@@ -323,7 +323,7 @@
                                /* log-2 base of history window (9 - 15) */
                                SEPARATE_ZVAL(tmpzval);
                                convert_to_long_ex(tmpzval);
-                               if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || 
Z_LVAL_PP(tmpzval) > MAX_WBITS) {
+                               if (Z_LVAL_PP(tmpzval) < -MAX_WBITS || 
Z_LVAL_PP(tmpzval) > MAX_WBITS + 32) {
                                        php_error_docref(NULL TSRMLS_CC, 
E_WARNING, "Invalid parameter give for window size. (%ld)", Z_LVAL_PP(tmpzval));
                                } else {
                                        windowBits = Z_LVAL_PP(tmpzval);

http://cvs.php.net/viewvc.cgi/php-src/ext/zlib/tests/zlib_filter_inflate2.phpt?view=markup&rev=1.1
Index: php-src/ext/zlib/tests/zlib_filter_inflate2.phpt
+++ php-src/ext/zlib/tests/zlib_filter_inflate2.phpt
--TEST--
zlib.inflate of gzip-encoded stream
--SKIPIF--
<?php if (!extension_loaded("zlib")) print "skip"; ?>
--FILE--
<?php /* $Id: zlib_filter_inflate2.phpt,v 1.1 2008/01/09 06:42:56 cellog Exp $ 
*/

$a = gzopen(dirname(__FILE__) . '/test.txt.gz', 'w');
fwrite($a, "This is quite the thing ain't it\n");
fclose($a);

$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ);
echo fread($fp, 2000);
fclose($fp);
echo "1\n";
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
// zlib format
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 
15+16));
echo "2\n";
echo fread($fp, 2000);
fclose($fp);
// auto-detect
$fp = fopen(dirname(__FILE__) . '/test.txt.gz', 'r');
stream_filter_append($fp, 'zlib.inflate', STREAM_FILTER_READ, array('window' => 
15+32));
echo "3\n";
echo fread($fp, 2000);
fclose($fp);

?>
--CLEAN--
<?php
@unlink(dirname(__FILE__) . '/test.txt.gz');
?>
--EXPECT--
1
2
This is quite the thing ain't it
3
This is quite the thing ain't it

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to