Skip to content
This repository has been archived by the owner on Jan 29, 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 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/Adapter/Digest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace Zend\Authentication\Adapter;

use Zend\Authentication\Result as AuthenticationResult;
use Zend\Stdlib\ErrorHandler;

/**
* @category Zend
Expand Down Expand Up @@ -169,8 +170,11 @@ public function authenticate()
}
}

if (false === ($fileHandle = @fopen($this->filename, 'r'))) {
throw new Exception\UnexpectedValueException("Cannot open '$this->filename' for reading");
ErrorHandler::start(E_WARNING);
$fileHandle = fopen($this->filename, 'r');
$error = ErrorHandler::stop();
if (false === $fileHandle) {
throw new Exception\UnexpectedValueException("Cannot open '$this->filename' for reading", 0, $error);
}

$id = "$this->username:$this->realm";
Expand Down
8 changes: 6 additions & 2 deletions src/Adapter/Http/FileResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

namespace Zend\Authentication\Adapter\Http;

use Zend\Stdlib\ErrorHandler;

/**
* HTTP Authentication File Resolver
*
Expand Down Expand Up @@ -102,9 +104,11 @@ public function resolve($username, $realm, $password = null)
}

// Open file, read through looking for matching credentials
$fp = @fopen($this->file, 'r');
ErrorHandler::start(E_WARNING);
$fp = fopen($this->file, 'r');
$error = ErrorHandler::stop();
if (!$fp) {
throw new Exception\RuntimeException('Unable to open password file: ' . $this->file);
throw new Exception\RuntimeException('Unable to open password file: ' . $this->file, 0, $error);
}

// No real validation is done on the contents of the password file. The
Expand Down

0 comments on commit df05eb8

Please sign in to comment.