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

Commit

Permalink
Merge remote-tracking branch 'weierophinney/feature/error-suppression…
Browse files Browse the repository at this point in the history
…-removal'
  • Loading branch information
akrabat committed Jul 13, 2012
5 parents dbb18b2 + c655082 + 97a9134 + 80367df + 970334c commit 4d4dd8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Filter/Regex.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Zend\Log\Filter;

use Zend\Log\Exception;
use Zend\Stdlib\ErrorHandler;

/**
* @category Zend
Expand All @@ -35,7 +36,10 @@ class Regex implements FilterInterface
*/
public function __construct($regex)
{
if (@preg_match($regex, '') === false) {
ErrorHandler::start(E_WARNING);
$result = preg_match($regex, '');
ErrorHandler::stop();
if ($result === false) {
throw new Exception\InvalidArgumentException(sprintf(
'Invalid regular expression "%s"',
$regex
Expand Down
6 changes: 5 additions & 1 deletion src/Writer/Stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Zend\Log\Exception;
use Zend\Log\Formatter\Simple as SimpleFormatter;
use Zend\Stdlib\ErrorHandler;

/**
* @category Zend
Expand Down Expand Up @@ -87,7 +88,10 @@ protected function doWrite(array $event)
{
$line = $this->formatter->format($event);

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

0 comments on commit 4d4dd8b

Please sign in to comment.