1--TEST-- 2gzcompress()/gzuncompress() and invalid params 3--EXTENSIONS-- 4zlib 5--FILE-- 6<?php 7 8try { 9 var_dump(gzcompress("", 1000)); 10} catch (\ValueError $e) { 11 echo $e->getMessage() . \PHP_EOL; 12} 13 14var_dump(gzcompress("", -1)); 15var_dump(gzcompress("")); 16var_dump(gzcompress("", 9)); 17 18$string = "Answer me, it can't be so hard 19Cry to relieve what's in your heart 20Desolation, grief and agony"; 21 22var_dump($data1 = gzcompress($string)); 23var_dump($data2 = gzcompress($string, 9)); 24 25try { 26 var_dump(gzuncompress("", 1000)); 27} catch (\ValueError $e) { 28 echo $e->getMessage() . \PHP_EOL; 29} 30 31try { 32 var_dump(gzuncompress("", -1)); 33} catch (\ValueError $e) { 34 echo $e->getMessage() . \PHP_EOL; 35} 36 37var_dump(gzuncompress("")); 38var_dump(gzuncompress("", 9)); 39 40var_dump(gzuncompress($data1)); 41var_dump(gzuncompress($data2)); 42$data2[4] = 0; 43var_dump(gzuncompress($data2)); 44 45?> 46--EXPECTF-- 47gzcompress(): Argument #2 ($level) must be between -1 and 9 48string(%d) "%a" 49string(%d) "%a" 50string(%d) "%a" 51string(%d) "%a" 52string(%d) "%a" 53 54Warning: gzuncompress(): %s error in %s on line %d 55bool(false) 56gzuncompress(): Argument #2 ($max_length) must be greater than or equal to 0 57 58Warning: gzuncompress(): %s error in %s on line %d 59bool(false) 60 61Warning: gzuncompress(): %s error in %s on line %d 62bool(false) 63string(94) "Answer me, it can't be so hard 64Cry to relieve what's in your heart 65Desolation, grief and agony" 66string(94) "Answer me, it can't be so hard 67Cry to relieve what's in your heart 68Desolation, grief and agony" 69 70Warning: gzuncompress(): %s error in %s on line %d 71bool(false) 72