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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 11:01:27 2024 UTC