Bug #78506 [Opn->Csd]: Error in a php_user_filter::filter() is not reported
| From: | nikic@php.net | Date: | Wed, 11 Sep 2019 08:32:47 +0000 |
| Subject: | Bug #78506 [Opn->Csd]: Error in a php_user_filter::filter() is not reported | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222689@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
Updated by: nikic@php.net
Reported by: thomas dot gerbet at enalean dot com
Summary: Error in a php_user_filter::filter() is not reported
-Status: Open
+Status: Closed
Type: Bug
Package: Streams related
PHP Version: 7.4.0RC1
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=11f3e24190fa45689c8ccaeea54a28db6752092e
Log: Fixed bug #78506
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