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-- Bug #78506: Error in a php_user_filter::filter() is not reported --FILE-- <?php ..

Decoded Output download

--TEST--
Bug #78506: Error in a php_user_filter::filter() is not reported
--FILE--
<?php

class MyFilter extends php_user_filter {
    public function filter($in, $out, &$consumed, $closing): int
    {
        stream_bucket_make_writeable($in);
        return PSFS_ERR_FATAL;
    }

}

stream_filter_register('filtername', MyFilter::class);

$source_resource = fopen('php://memory', 'rb+');
fwrite($source_resource, 'Test data');
rewind($source_resource);

stream_filter_prepend($source_resource,'filtername',STREAM_FILTER_READ);

var_dump(stream_copy_to_stream($source_resource, fopen('php://memory', 'wb')));

?>
--EXPECT--
bool(false)

Did this file decode correctly?

Original Code

--TEST--
Bug #78506: Error in a php_user_filter::filter() is not reported
--FILE--
<?php

class MyFilter extends php_user_filter {
    public function filter($in, $out, &$consumed, $closing): int
    {
        stream_bucket_make_writeable($in);
        return PSFS_ERR_FATAL;
    }

}

stream_filter_register('filtername', MyFilter::class);

$source_resource = fopen('php://memory', 'rb+');
fwrite($source_resource, 'Test data');
rewind($source_resource);

stream_filter_prepend($source_resource,'filtername',STREAM_FILTER_READ);

var_dump(stream_copy_to_stream($source_resource, fopen('php://memory', 'wb')));

?>
--EXPECT--
bool(false)

Function Calls

None

Variables

None

Stats

MD5 cae1079848f0a674ddb413791d6decdc
Eval Count 0
Decode Time 86 ms