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

Commit

Permalink
Merge pull request zendframework/zendframework#2210 from weierophinne…
Browse files Browse the repository at this point in the history
…y/hotfix/remove-suppression-operator

Get rid of error suppression
  • Loading branch information
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Filter/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ public function __construct($regex)
}
ErrorHandler::start(E_WARNING);
$result = preg_match($regex, '');
ErrorHandler::stop();
$error = ErrorHandler::stop();
if ($result === false) {
throw new Exception\InvalidArgumentException(sprintf(
'Invalid regular expression "%s"',
$regex
));
), 0, $error);
}
$this->regex = $regex;
}
Expand Down
11 changes: 7 additions & 4 deletions src/Writer/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,15 @@ public function __construct($streamOrUrl, $mode = null, $logSeparator = null)

$this->stream = $streamOrUrl;
} else {
if (!$this->stream = @fopen($streamOrUrl, $mode, false)) {
ErrorHandler::start();
$this->stream = fopen($streamOrUrl, $mode, false);
$error = ErrorHandler::stop();
if (!$this->stream) {
throw new Exception\RuntimeException(sprintf(
'"%s" cannot be opened with mode "%s"',
$streamOrUrl,
$mode
));
), 0, $error);
}
}

Expand All @@ -109,9 +112,9 @@ protected function doWrite(array $event)

ErrorHandler::start(E_WARNING);
$result = fwrite($this->stream, $line);
ErrorHandler::stop();
$error = ErrorHandler::stop();
if (false === $result) {
throw new Exception\RuntimeException("Unable to write to stream");
throw new Exception\RuntimeException("Unable to write to stream", 0, $error);
}
}

Expand Down

0 comments on commit 76607e3

Please sign in to comment.