Bug #67626 [Opn->Csd]: User exceptions not properly handled

From: Date: Mon, 09 Mar 2015 06:45:28 +0000
Subject: Bug #67626 [Opn->Csd]: User exceptions not properly handled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-191258@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67626&edit=1

 ID:                 67626
 Updated by:         stas@php.net
 Reported by:        jpauli@php.net
 Summary:            User exceptions not properly handled
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Streams related
 Operating System:   *
 PHP Version:        5.5.14
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of jpauli
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c4c3dca302df627c492e6ce885b777f21dce9f78
Log: Fix #67626


Previous Comments:
------------------------------------------------------------------------
[2014-07-15 15:00:50] jpauli@php.net

Description:
------------
Throwing an exception in userland functions of stream wrappers is not correctly taken care of by the
engine.

Test script:
---------------
class MyStream
{
	public function stream_open() { return true; }
	
	public function stream_read()
	{
		throw new Exception('boo!');
		return 42;
	}
	
	public function stream_eof()
	{
		return true;
	}
}


stream_wrapper_register("my", "MyStream");
$fp = fopen('my://foobar', 'r+');
fread($fp, 512);

Expected result:
----------------
Fatal error: Uncaught exception 'Exception' ...

Actual result:
--------------
Warning: fread(): MyStream::stream_eof is not implemented! Assuming EOF in /tmp/streams.php on line
35

Fatal error: Uncaught exception 'Exception'...


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=67626&edit=1


Thread (2 messages)

« previous php.bugs (#191258) next »