Bug #78506 [NEW]: Error in a php_user_filter::filter() is not reported
| From: | thomas dot gerbet at enalean dot com | Date: | Fri, 06 Sep 2019 19:25:05 +0000 |
| Subject: | Bug #78506 [NEW]: Error in a php_user_filter::filter() is not reported | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222612@lists.php.net to get a copy of this message | ||
From: thomas dot gerbet at enalean dot com
Operating system:
PHP version: 7.4.0RC1
Package: Streams related
Bug Type: Bug
Bug description:Error in a php_user_filter::filter() is not reported
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 bug report at https://bugs.php.net/bug.php?id=78506&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78506&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78506&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78506&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78506&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78506&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78506&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78506&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78506&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78506&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78506&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78506&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78506&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78506&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78506&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78506&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78506&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78506&r=mysqlcfg