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 17 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/Filter/NumberFormat.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use NumberFormatter;
use Traversable;
use Zend\I18n\Exception;
use Zend\Stdlib\ErrorHandler;

class NumberFormat extends AbstractLocale
{
Expand Down Expand Up @@ -143,10 +144,14 @@ public function filter($value)
$type = $this->getType();

if (is_int($value) || is_float($value)) {
$result = @numfmt_format($formatter, $value, $type);
ErrorHandler::start();
$result = $formatter->format($value, $type);
ErrorHandler::stop();
} else {
$value = str_replace(array("\xC2\xA0", ' '), '', $value);
$result = @numfmt_parse($formatter, $value, $type);
ErrorHandler::start();
$result = $formatter->parse($value, $type);
ErrorHandler::stop();
}

if ($result === false) {
Expand Down
11 changes: 10 additions & 1 deletion src/Translator/Loader/Gettext.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Zend\I18n\Exception;
use Zend\I18n\Translator\Plural\Rule as PluralRule;
use Zend\I18n\Translator\TextDomain;
use Zend\Stdlib\ErrorHandler;

/**
* Gettext loader.
Expand Down Expand Up @@ -57,7 +58,15 @@ public function load($filename, $locale)

$textDomain = new TextDomain();

$this->file = @fopen($filename, 'rb');
ErrorHandler::start();
$this->file = fopen($filename, 'rb');
$error = ErrorHandler::stop();
if (false === $this->file) {
throw new Exception\InvalidArgumentException(sprintf(
'Could not open file %s for reading',
$filename
), 0, $error);
}

// Verify magic number
$magic = fread($this->file, 4);
Expand Down

0 comments on commit d4af079

Please sign in to comment.