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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 11:01:28 2024 UTC