Bug #66932 [Opn->Nab]: User stream filter errors cannot be handled
| From: | mike@php.net | Date: | Thu, 03 Apr 2014 08:50:40 +0000 |
| Subject: | Bug #66932 [Opn->Nab]: User stream filter errors cannot be handled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185057@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66932&edit=1
ID: 66932
Updated by: mike@php.net
Reported by: ezzatron at gmail dot com
Summary: User stream filter errors cannot be handled
-Status: Open
+Status: Not a bug
Type: Bug
Package: Streams related
Operating System: OS X 10.9.2
PHP Version: 5.5.10
Block user comment: N
Private report: N
New Comment:
fwrite() only returns FALSE on invalid params.
A return value of 0 is pretty indicative of a failure to me.
Previous Comments:
------------------------------------------------------------------------
[2014-03-19 11:09:17] 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)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66932&edit=1