Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit caebdb4

Browse files
committed
Merge branch 'hotfix/314'
Close #314
2 parents 1676072 + db7d8cf commit caebdb4

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25-
- Nothing.
25+
- [#314](https://github.com/zendframework/zend-diactoros/pull/314) modifies error handling around opening a file resource within
26+
`Zend\Diactoros\Stream::setStream()` to no longer use the second argument to
27+
`set_error_handler()`, and instead check the error type in the handler itself;
28+
this fixes an issue when the handler is nested inside another error handler,
29+
which currently has buggy behavior within the PHP engine.
2630

2731
## 1.8.1 - 2018-07-09
2832

src/Stream.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,12 @@ private function setStream($stream, $mode = 'r')
330330

331331
if (is_string($stream)) {
332332
set_error_handler(function ($e) use (&$error) {
333+
if ($e !== E_WARNING) {
334+
return;
335+
}
336+
333337
$error = $e;
334-
}, E_WARNING);
338+
});
335339
$resource = fopen($stream, $mode);
336340
restore_error_handler();
337341
}

0 commit comments

Comments
 (0)