1--TEST--
2Bug #78662 (stream_write bad error detection)
3--FILE--
4<?php
5class FailedStream {
6    function stream_open($path, $mode, $options, &$opened_path)
7    {
8        return true;
9    }
10    function stream_read($count)
11    {
12        return false;
13    }
14    function stream_write($data)
15    {
16        return false;
17    }
18    function stream_stat()
19    {
20        return [];
21    }
22}
23stream_wrapper_register('fails', 'FailedStream');
24$f=fopen('fails://foo', 'a+');
25var_dump(fwrite($f, "bar"));
26var_dump(fread($f, 100));
27?>
28Done
29--EXPECTF--
30bool(false)
31bool(false)
32Done
33