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

Commit

Permalink
Merge branch 'hotfix/314'
Browse files Browse the repository at this point in the history
Close #314
  • Loading branch information
weierophinney committed Jul 19, 2018
2 parents 1676072 + db7d8cf commit caebdb4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

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

## 1.8.1 - 2018-07-09

Expand Down
6 changes: 5 additions & 1 deletion src/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,12 @@ private function setStream($stream, $mode = 'r')

if (is_string($stream)) {
set_error_handler(function ($e) use (&$error) {
if ($e !== E_WARNING) {
return;
}

$error = $e;
}, E_WARNING);
});
$resource = fopen($stream, $mode);
restore_error_handler();
}
Expand Down

0 comments on commit caebdb4

Please sign in to comment.