Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- gzencode() and invalid params --EXTENSIONS-- zlib --FILE-- <?php try { var_d..

Decoded Output download

--TEST--
gzencode() and invalid params
--EXTENSIONS--
zlib
--FILE--
<?php

try {
    var_dump(gzencode("", -10));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    var_dump(gzencode("", 100));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    var_dump(gzencode("", 1, 100));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode("", 9, ZLIB_ENCODING_DEFLATE));

$string = "Light of my sun
Light in this temple
Light in my truth
Lies in the darkness";

try {
    var_dump(gzencode($string, 9, 3));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE));

?>
--EXPECTF--
gzencode(): Argument #2 ($level) must be between -1 and 9
gzencode(): Argument #2 ($level) must be between -1 and 9
gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"
gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"

Did this file decode correctly?

Original Code

--TEST--
gzencode() and invalid params
--EXTENSIONS--
zlib
--FILE--
<?php

try {
    var_dump(gzencode("", -10));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    var_dump(gzencode("", 100));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}
try {
    var_dump(gzencode("", 1, 100));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

var_dump(gzencode("", -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode("", 9, ZLIB_ENCODING_DEFLATE));

$string = "Light of my sun
Light in this temple
Light in my truth
Lies in the darkness";

try {
    var_dump(gzencode($string, 9, 3));
} catch (\ValueError $e) {
    echo $e->getMessage() . \PHP_EOL;
}

var_dump(gzencode($string, -1, ZLIB_ENCODING_GZIP));
var_dump(gzencode($string, 9, ZLIB_ENCODING_DEFLATE));

?>
--EXPECTF--
gzencode(): Argument #2 ($level) must be between -1 and 9
gzencode(): Argument #2 ($level) must be between -1 and 9
gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"
gzencode(): Argument #3 ($encoding) must be one of ZLIB_ENCODING_RAW, ZLIB_ENCODING_GZIP, or ZLIB_ENCODING_DEFLATE
string(%d) "%a"
string(%d) "%a"

Function Calls

None

Variables

None

Stats

MD5 3a3265e381adce14f530608e9844bf33
Eval Count 0
Decode Time 104 ms