Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
strict comparison for getting array value by key
Browse files Browse the repository at this point in the history
When getting errors, loose equality sometimes matches the 0 index of the array of errors and not the nested 'Errors' key.  This results in an index 'Number' not found exception on `$this->setErrorCode($errorInfo['Number']);`
  • Loading branch information
sethphillips authored Jul 23, 2018
1 parent e3f73cd commit 1ff620a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/USPSBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ public function getErrorMessage()
protected function getValueByKey($array, $key)
{
foreach ($array as $k => $each) {
if ($k == $key) {
if ($k === $key) {
return $each;
}

Expand Down

0 comments on commit 1ff620a

Please sign in to comment.