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-- Test incremental deflate_add() error functionality --EXTENSIONS-- zlib --FILE-- <..
Decoded Output download
--TEST--
Test incremental deflate_add() error functionality
--EXTENSIONS--
zlib
--FILE--
<?php
$badResource = fopen("php://memory", "r+");
try {
var_dump(deflate_add($badResource, "test"));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$resource = deflate_init(ZLIB_ENCODING_DEFLATE);
$badFlushType = 6789;
try {
var_dump(deflate_add($resource, "test", $badFlushType));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
Did this file decode correctly?
Original Code
--TEST--
Test incremental deflate_add() error functionality
--EXTENSIONS--
zlib
--FILE--
<?php
$badResource = fopen("php://memory", "r+");
try {
var_dump(deflate_add($badResource, "test"));
} catch (\TypeError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$resource = deflate_init(ZLIB_ENCODING_DEFLATE);
$badFlushType = 6789;
try {
var_dump(deflate_add($resource, "test", $badFlushType));
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
?>
--EXPECT--
deflate_add(): Argument #1 ($context) must be of type DeflateContext, resource given
deflate_add(): Argument #3 ($flush_mode) must be one of ZLIB_NO_FLUSH, ZLIB_PARTIAL_FLUSH, ZLIB_SYNC_FLUSH, ZLIB_FULL_FLUSH, ZLIB_BLOCK, or ZLIB_FINISH
Function Calls
fopen | 1 |
Stats
MD5 | 22c50e3e99869df10e89728abf9ee246 |
Eval Count | 0 |
Decode Time | 95 ms |