Bug #78506 [Com]: Error in a php_user_filter::filter() is not reported
| From: | jacksmith0374 at gmail dot com | Date: | Sat, 07 Sep 2019 06:29:45 +0000 |
| Subject: | Bug #78506 [Com]: Error in a php_user_filter::filter() is not reported | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222616@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78506&edit=1
ID: 78506
Comment by: jacksmith0374 at gmail dot com
Reported by: thomas dot gerbet at enalean dot com
Summary: Error in a php_user_filter::filter() is not reported
Status: Open
Type: Bug
Package: Streams related
PHP Version: 7.4.0RC1
Block user comment: N
Private report: N
New Comment:
Thanks for the informative article. This is one of the best resources I have found in quite some
time. Nicely written and great info, I really thank you for sharing it.
https://geeksupporttech.com
Previous Comments:
------------------------------------------------------------------------
[2019-09-06 19:25:05] thomas dot gerbet at enalean dot com
Description:
------------
Previously when an implementation of php_user_filter::filter() returned PSFS_ERR_FATAL,
stream_copy_to_stream() was returning false we now get 0.
https://3v4l.org/dD9ZH
This seems to have been introduced by https://github.com/php/php-src/commit/d59aac58b3e7da7ad01a194fe9840d89725ea229
Is this behavior change expected?
Test script:
---------------
<?php
class MyFilter extends php_user_filter {
public function filter($in, $out, &$consumed, $closing)
{
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')));
Expected result:
----------------
bool(false)
Actual result:
--------------
int(0)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78506&edit=1