php.net |  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ezzatron at gmail dot com
New email:
PHP Version: OS:

 

 [2014-03-19 11:09 UTC] ezzatron at gmail dot com
Description:
------------
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:
---------------
<?php

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'));
fclose($stream);


Expected result:
----------------
bool(false)

Actual result:
--------------
int(0)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

A return value of 0 is pretty indicative of a failure to me.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri Oct 18 06:01:27 2019 UTC