php-src/Zend/tests/include_fail_during_read.phpt
Nikita Popov 2f64844495 Fix leak when include fails in a read operation
Usually it will already fail when opening, but reads can also
fail since PHP 7.4, in which case we still need to place the
file handle in open_files to make sure the destructor will run
on it.
2019-10-07 17:29:33 +02:00

13 lines
461 B
PHP

--TEST--
Include fails during read
--FILE--
<?php
class SampleFilter extends php_user_filter { }
stream_filter_register('sample.filter', SampleFilter::class);
include 'php://filter/read=sample.filter/resource='. __FILE__;
?>
--EXPECTF--
Warning: include(): Unprocessed filter buckets remaining on input brigade in %s on line %d
Warning: include(): Failed opening 'php://filter/read=sample.filter/resource=%s' for inclusion (include_path='%s') in %s on line %d