Skip to content

Commit 93acbf4

Browse files
committed
fix error handler edge case
1 parent 28c3a8c commit 93acbf4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Adapter/IO/StreamIO.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ public function write($data)
190190
* continued sending the data, we will catch feof() only after some time
191191
*/
192192
$oreporting = error_reporting(E_ALL);
193-
$ohandler = set_error_handler(function($severity, $text) {
193+
set_error_handler(function($severity, $text) {
194+
//$ohandler = set_error_handler(function($severity, $text) {
194195
throw new \RuntimeException('fwrite() error (' . $severity . '): ' . $text);
195196
});
196197

@@ -228,13 +229,15 @@ public function write($data)
228229
* Restore original handlers after normal operations
229230
*/
230231
error_reporting($oreporting);
231-
set_error_handler($ohandler);
232+
//set_error_handler($ohandler);
233+
restore_error_handler();
232234
} catch (\Exception $t) {
233235
/**
234236
* Restore original handlers if exception happens
235237
*/
236238
error_reporting($oreporting);
237-
set_error_handler($ohandler);
239+
//set_error_handler($ohandler);
240+
restore_error_handler();
238241
throw new RuntimeException($t->getMessage(), $t->getCode());
239242
}
240243
}

0 commit comments

Comments
 (0)