|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66932 User stream filter errors cannot be handled
Submitted: 2014-03-19 11:09 UTC Modified: 2014-04-03 08:50 UTC
From: ezzatron at gmail dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.5.10 OS: OS X 10.9.2
Private report: No CVE-ID: None
 [2014-03-19 11:09 UTC] ezzatron at gmail dot com
The constant PSFS_ERR_FATAL used to indicate an error condition in a user stream filter has no effect on the return value of relevant stream functions, and there is no alternative way to detect these errors.

Test script:

class FatalFilter extends php_user_filter
    function filter($in, $out, &$consumed, $closing)
        $bucket = stream_bucket_make_writeable($in);

        return PSFS_ERR_FATAL;

stream_filter_register('fatal', 'FatalFilter');

$stream = fopen('php://memory', 'wb');
stream_filter_append($stream, 'fatal');
var_dump(fwrite($stream, 'foobar'));

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-04-03 08:50 UTC]
-Status: Open +Status: Not a bug
 [2014-04-03 08:50 UTC]
fwrite() only returns FALSE on invalid params.

A return value of 0 is pretty indicative of a failure to me.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 12:01:25 2023 UTC