@@ -28,7 +28,8 @@ class TestStream {
2828stream_wrapper_register ('test ' , 'TestStream ' );
2929
3030function stream_test_errors ($ title , $ context ) {
31- $ stream = fopen ('test://foo ' , 'r ' , false , $ context );
31+ stream_context_set_default ($ context );
32+ $ stream = fopen ('test://foo ' , 'r ' , false );
3233 try {
3334 echo $ title . "\n" ;
3435 $ readin = fopen ('php://stdin ' , 'r ' );
@@ -55,7 +56,7 @@ function stream_test_errors($title, $context) {
5556 $ current = $ error ;
5657 $ idx = 0 ;
5758 while ($ current ) {
58- echo " [ $ idx] " . $ current ->code ->name . ": " . substr ( $ current ->message , 0 , 50 ) . "... \n" ;
59+ echo " [ $ idx] " . $ current ->code ->name . ": " . $ current ->message . "\n" ;
5960 $ current = $ current ->next ;
6061 $ idx ++;
6162 }
@@ -65,53 +66,52 @@ function stream_test_errors($title, $context) {
6566 echo "\n" ;
6667}
6768
68- stream_test_errors ('ALL ' , stream_context_create ( [
69+ stream_test_errors ('ALL ' , [
6970 'stream ' => [
7071 'error_mode ' => StreamErrorMode::Silent,
7172 'error_store ' => StreamErrorStore::All,
7273 ]
73- ])) ;
74+ ]);
7475
75- stream_test_errors ('NON TERMINAL ' , stream_context_create ( [
76+ stream_test_errors ('NON TERMINAL ' , [
7677 'stream ' => [
7778 'error_mode ' => StreamErrorMode::Silent,
7879 'error_store ' => StreamErrorStore::NonTerminal,
7980 ]
80- ])) ;
81+ ]);
8182
82- stream_test_errors ('TERMINAL ' , stream_context_create ( [
83+ stream_test_errors ('TERMINAL ' , [
8384 'stream ' => [
8485 'error_mode ' => StreamErrorMode::Silent,
8586 'error_store ' => StreamErrorStore::Terminal,
8687 ]
87- ])) ;
88+ ]);
8889
89- stream_test_errors ('AUTO EXCEPTION ' , stream_context_create ( [
90+ stream_test_errors ('AUTO EXCEPTION ' , [
9091 'stream ' => [
9192 'error_mode ' => StreamErrorMode::Exception,
9293 'error_store ' => StreamErrorStore::Auto,
9394 ]
94- ])) ;
95+ ]);
9596
96- stream_test_errors ('AUTO ERROR ' , stream_context_create ( [
97+ stream_test_errors ('AUTO ERROR ' , [
9798 'stream ' => [
9899 'error_mode ' => StreamErrorMode::Error,
99100 'error_store ' => StreamErrorStore::Auto,
100101 ]
101- ])) ;
102+ ]);
102103
103104?>
104105--EXPECTF--
105106ALL
106107Error details:
107- - Message: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
108- - Code: UserspaceInvalidReturn (161 )
108+ - Message: TestStream::stream_cast is not implemented!
109+ - Code: NotImplemented (70 )
109110- Wrapper: user-space
110- - Terminating: no
111- - Count: 3
112- [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data ...
113- [1] NotImplemented: TestStream::stream_cast is not implemented!...
114- [2] CastNotSupported: Cannot represent a stream of type user-space as...
111+ - Terminating: yes
112+ - Count: 2
113+ [0] NotImplemented: TestStream::stream_cast is not implemented!
114+ [1] CastNotSupported: Cannot represent a stream of type user-space as a select()able descriptor
115115
116116NON TERMINAL
117117Error details:
@@ -120,7 +120,7 @@ Error details:
120120- Wrapper: user-space
121121- Terminating: no
122122- Count: 1
123- [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data ...
123+ [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
124124
125125TERMINAL
126126Error details:
@@ -129,18 +129,18 @@ Error details:
129129- Wrapper: user-space
130130- Terminating: yes
131131- Count: 2
132- [0] NotImplemented: TestStream::stream_cast is not implemented!...
133- [1] CastNotSupported: Cannot represent a stream of type user-space as...
132+ [0] NotImplemented: TestStream::stream_cast is not implemented!
133+ [1] CastNotSupported: Cannot represent a stream of type user-space as a select()able descriptor
134134
135135AUTO EXCEPTION
136- EXCEPTION: Cannot represent a stream of type user-space as a select()able descriptor
136+ EXCEPTION: TestStream::stream_cast is not implemented!
137137Error details:
138138- Message: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
139139- Code: UserspaceInvalidReturn (161)
140140- Wrapper: user-space
141141- Terminating: no
142142- Count: 1
143- [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data ...
143+ [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
144144
145145AUTO ERROR
146146
@@ -149,4 +149,10 @@ Warning: fread(): TestStream::stream_read - read 10 bytes more data than request
149149Warning: stream_select(): TestStream::stream_cast is not implemented! in %s on line %d
150150
151151Warning: stream_select(): Cannot represent a stream of type user-space as a select()able descriptor in %s on line %d
152- No errors stored
152+ Error details:
153+ - Message: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
154+ - Code: UserspaceInvalidReturn (161)
155+ - Wrapper: user-space
156+ - Terminating: no
157+ - Count: 1
158+ [0] UserspaceInvalidReturn: TestStream::stream_read - read 10 bytes more data than requested (8202 read, 8192 max) - excess data will be lost
0 commit comments