php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78506 Error in a php_user_filter::filter() is not reported
Submitted: 2019-09-06 19:25 UTC Modified: 2019-09-07 16:26 UTC
From: thomas dot gerbet at enalean dot com Assigned:
Status: Closed Package: Streams related
PHP Version: 7.4.0RC1 OS:
Private report: No CVE-ID: None
 [2019-09-06 19:25 UTC] 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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-11 08:32 UTC] nikic@php.net
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
 [2019-09-11 08:32 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC