1--TEST--
2Bug #67626: Exceptions not properly handled in user stream handlers
3--FILE--
4<?php
5class MyStream
6{
7	public function stream_open() { return true; }
8
9	public function stream_read()
10	{
11		throw new Exception('stream_read_exception');
12		return 'read';
13	}
14
15	public function stream_eof()
16	{
17		return true;
18	}
19
20	public function stream_write()
21	{
22		throw new Exception('stream_write_exception');
23		return 42;
24	}
25}
26
27stream_wrapper_register("my", "MyStream");
28
29$fp = fopen('my://foobar', 'r+');
30
31try {
32	fread($fp, 42);
33} catch (Exception $e) {
34	echo $e->getMessage();
35}
36echo "\n";
37try {
38	fwrite($fp, 'foobar');
39} catch (Exception $e) {
40	echo $e->getMessage();
41}
42?>
43--EXPECTF--
44stream_read_exception
45stream_write_exception
46