Skip to content

Commit

Permalink
Prefer strict comparisons when using in_array()
Browse files Browse the repository at this point in the history
  • Loading branch information
thijskh committed May 27, 2018
1 parent b9c92c6 commit 5b0a9aa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function validate(Assertion $assertion, Result $result)
}

$entityId = $this->serviceProvider->getEntityId();
if (!in_array($entityId, $intendedAudiences)) {
if (!in_array($entityId, $intendedAudiences, true)) {
$result->addError(sprintf(
'The configured Service Provider [%s] is not a valid audience for the assertion. Audiences: [%s]',
$entityId,
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/AuthnRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public function toUnsignedXML()
'ProviderID',
'Loc',
'Name'
))) {
), true)) {
$idpEntry->setAttribute($attribute, $value);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Certificate/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct(array $keyData)
*/
public function canBeUsedFor($usage)
{
if (!in_array($usage, static::getValidKeyUsages())) {
if (!in_array($usage, static::getValidKeyUsages(), true)) {
throw new InvalidKeyUsageException($usage);
}

Expand Down
2 changes: 1 addition & 1 deletion src/SAML2/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function castKey(XMLSecurityKey $key, $algorithm, $type = 'public'
XMLSecurityKey::RSA_SHA256,
XMLSecurityKey::RSA_SHA384,
XMLSecurityKey::RSA_SHA512
))) {
), true)) {
throw new \Exception('Unsupported signing algorithm.');
}

Expand Down

0 comments on commit 5b0a9aa

Please sign in to comment.