File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 90
90
'id ' => $ data ->id ,
91
91
'error ' => array ('message ' => $ e ->getMessage ())
92
92
));
93
+ } catch (Error $ e ) {
94
+ $ out ->write (array (
95
+ 'id ' => $ data ->id ,
96
+ 'error ' => array ('message ' => $ e ->getMessage ())
97
+ ));
93
98
}
94
99
} elseif ($ data ->method === 'open ' && \count ($ data ->params ) === 2 && \is_string ($ data ->params [0 ]) && \is_int ($ data ->params [1 ])) {
95
100
// open database with two parameters: $filename, $flags
108
113
'id ' => $ data ->id ,
109
114
'error ' => array ('message ' => $ e ->getMessage ())
110
115
));
116
+ } catch (Error $ e ) {
117
+ $ out ->write (array (
118
+ 'id ' => $ data ->id ,
119
+ 'error ' => array ('message ' => $ e ->getMessage ())
120
+ ));
111
121
}
112
122
} elseif ($ data ->method === 'exec ' && $ db !== null && \count ($ data ->params ) === 1 && \is_string ($ data ->params [0 ])) {
113
123
// execute statement and suppress PHP warnings
Original file line number Diff line number Diff line change @@ -134,6 +134,29 @@ public function testOpenInvalidPathRejects($flag)
134
134
$ loop ->run ();
135
135
}
136
136
137
+ /**
138
+ * @dataProvider provideSocketFlags
139
+ * @param bool $flag
140
+ */
141
+ public function testOpenInvalidPathWithNullByteRejects ($ flag )
142
+ {
143
+ $ loop = \React \EventLoop \Factory::create ();
144
+ $ factory = new Factory ($ loop );
145
+
146
+ $ ref = new \ReflectionProperty ($ factory , 'useSocket ' );
147
+ $ ref ->setAccessible (true );
148
+ $ ref ->setValue ($ factory , $ flag );
149
+
150
+ $ promise = $ factory ->open ("test \0.db " );
151
+
152
+ $ promise ->then (
153
+ null ,
154
+ $ this ->expectCallableOnceWith ($ this ->isInstanceOf ('RuntimeException ' ))
155
+ );
156
+
157
+ $ loop ->run ();
158
+ }
159
+
137
160
/**
138
161
* @dataProvider provideSocketFlags
139
162
* @param bool $flag
You can’t perform that action at this time.
0 commit comments