]> granicus.if.org Git - php/commitdiff
Fix unrelated tests and zlib window size
authorBob Weinand <bobwei9@hotmail.com>
Fri, 15 May 2015 11:59:47 +0000 (13:59 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Fri, 15 May 2015 11:59:47 +0000 (13:59 +0200)
ext/zlib/tests/inflate_init_error.phpt
ext/zlib/zlib.c

index 0e0e8b33bf3d1fa1f79f62e02fbed5d44314357d..58c07a426ca77d608a19506161b3e9a3d287332e 100644 (file)
@@ -13,7 +13,7 @@ var_dump(inflate_init(42));
 ?>
 --EXPECTF--
 
-Warning: inflate_init() expects exactly 1 parameter, 0 given in %s on line %d
+Warning: inflate_init() expects at least 1 parameter, 0 given in %s on line %d
 NULL
 
 Warning: inflate_init(): encoding mode must be ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP or ZLIB_ENCODING_DEFLATE in %s on line %d
index 31fe18db021842e3d5b2ddfa6c0bf7db2da46489..81694243627bda152b419e2e5117127a7ea80242 100644 (file)
@@ -827,7 +827,7 @@ PHP_FUNCTION(inflate_init)
        zend_long encoding, window = 15;
        char *dict = NULL;
        size_t dictlen = 0;
-       HashTable *options;
+       HashTable *options = NULL;
        zval *option_buffer;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l|H", &encoding, &options)) {
@@ -865,7 +865,7 @@ PHP_FUNCTION(inflate_init)
        if (encoding < 0) {
                encoding += 15 - window;
        } else {
-               encoding &= window;
+               encoding -= 15 - window;
        }
 
        if (Z_OK == inflateInit2(ctx, encoding)) {
@@ -997,7 +997,7 @@ PHP_FUNCTION(deflate_init)
        zend_long encoding, level = -1, memory = 8, window = 15, strategy = Z_DEFAULT_STRATEGY;
        char *dict = NULL;
        size_t dictlen = 0;
-       HashTable *options = 0;
+       HashTable *options = NULL;
        zval *option_buffer;
 
        if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS(), "l|H", &encoding, &options)) {
@@ -1065,7 +1065,7 @@ PHP_FUNCTION(deflate_init)
        if (encoding < 0) {
                encoding += 15 - window;
        } else {
-               encoding &= window;
+               encoding -= 15 - window;
        }
 
        if (Z_OK == deflateInit2(ctx, level, Z_DEFLATED, encoding, memory, strategy)) {