Skip to content

Commit de1a694

Browse files
committed
PHP 8 issues
1 parent eab183a commit de1a694

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright © 2021 Lukas Buchs
3+
Copyright © 2022 Lukas Buchs
44
Copyright © 2018 Thomas Bleeker (CBOR & ByteBuffer part)
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy

_test/client.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!DOCTYPE html>
22
<!--
3-
Copyright (C) 2018 Lukas Buchs
3+
Copyright (C) 2022 Lukas Buchs
44
license https://github.com/lbuchs/WebAuthn/blob/master/LICENSE MIT
55
-->
66
<html>
@@ -513,7 +513,7 @@ <h1 style="margin: 40px 10px 2px 0;">lbuchs/WebAuthn</h1>
513513
the browser may not warn about providing informations about your device.
514514
</div>
515515
<div style="margin-top:20px;font-size: 0.7em;font-style: italic">
516-
Copyright &copy; 2021 Lukas Buchs - <a href="https://raw.githubusercontent.com/lbuchs/WebAuthn/master/LICENSE">license therms</a>
516+
Copyright &copy; 2022 Lukas Buchs - <a href="https://raw.githubusercontent.com/lbuchs/WebAuthn/master/LICENSE">license therms</a>
517517
</div>
518518

519519
</div>

_test/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22

33
/*
4-
* Copyright (C) 2018 Lukas Buchs
4+
* Copyright (C) 2022 Lukas Buchs
55
* license https://github.com/lbuchs/WebAuthn/blob/master/LICENSE MIT
66
*
77
* Server test script for WebAuthn library. Saves new registrations in session.
@@ -312,7 +312,7 @@
312312
} else if (is_object($value)) {
313313
$value = chunk_split(strval($value), 64);
314314

315-
} else if (is_string($value) && strlen($value) > 0 && htmlspecialchars($value) === '') {
315+
} else if (is_string($value) && strlen($value) > 0 && htmlspecialchars($value, ENT_QUOTES) === '') {
316316
$value = chunk_split(bin2hex($value), 64);
317317
}
318318
$html .= '<tr><td>' . htmlspecialchars($key) . '</td><td style="font-family:monospace;">' . nl2br(htmlspecialchars($value)) . '</td>';

src/Attestation/Format/AndroidSafetyNet.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function __construct($AttestionObject, AuthenticatorData $authenticatorDa
5252
throw new WebAuthnException('invalid JWS payload', WebAuthnException::INVALID_DATA);
5353
}
5454

55-
if (!$header->x5c || !is_array($header->x5c) || count($header->x5c) === 0) {
55+
if (!isset($header->x5c) || !is_array($header->x5c) || count($header->x5c) === 0) {
5656
throw new WebAuthnException('No X.509 signature in JWS Header', WebAuthnException::INVALID_DATA);
5757
}
5858

@@ -89,7 +89,7 @@ public function validateAttestation($clientDataHash) {
8989

9090
// Verify that the nonce in the response is identical to the Base64 encoding
9191
// of the SHA-256 hash of the concatenation of authenticatorData and clientDataHash.
92-
if (!$this->_payload->nonce || $this->_payload->nonce !== \base64_encode(\hash('SHA256', $this->_authenticatorData->getBinary() . $clientDataHash, true))) {
92+
if (empty($this->_payload->nonce) || $this->_payload->nonce !== \base64_encode(\hash('SHA256', $this->_authenticatorData->getBinary() . $clientDataHash, true))) {
9393
throw new WebAuthnException('invalid nonce in JWS payload', WebAuthnException::INVALID_DATA);
9494
}
9595

@@ -100,7 +100,7 @@ public function validateAttestation($clientDataHash) {
100100
}
101101

102102
// Verify that the ctsProfileMatch attribute in the payload of response is true.
103-
if (!$this->_payload->ctsProfileMatch) {
103+
if (empty($this->_payload->ctsProfileMatch)) {
104104
throw new WebAuthnException('invalid ctsProfileMatch in payload', WebAuthnException::INVALID_DATA);
105105
}
106106

src/Attestation/Format/Apple.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ protected function _validateOverX5c($clientDataHash) {
105105

106106
// Verify that nonce equals the value of the extension with OID ( 1.2.840.113635.100.8.2 ) in credCert.
107107
$parsedCredCert = openssl_x509_parse($credCert);
108-
$nonceExtension = isset($parsedCredCert['extensions']['1.2.840.113635.100.8.2']) ? $parsedCredCert['extensions']['1.2.840.113635.100.8.2'] : '';
108+
$nonceExtension = $parsedCredCert['extensions']['1.2.840.113635.100.8.2'] ?? '';
109109

110110
// nonce padded by ASN.1 string: 30 24 A1 22 04 20
111111
// 30 — type tag indicating sequence

0 commit comments

Comments
 (0)