Fix phpstan problems in test db encryption file

This commit is contained in:
Clemens Schwaighofer
2025-04-15 17:46:41 +09:00
parent 1cfdc45107
commit a66cc09095

View File

@@ -136,14 +136,14 @@ if ($res === false) {
if (hash_equals($string_hmac, $res['pg_hmac_text'])) { if (hash_equals($string_hmac, $res['pg_hmac_text'])) {
print "libsodium and pgcrypto hash hmac match<br>"; print "libsodium and pgcrypto hash hmac match<br>";
} }
} // do compare for PHP and pgcrypto settings
$encryptedMessage_template = <<<TEXT $encryptedMessage_template = <<<TEXT
-----BEGIN PGP MESSAGE----- -----BEGIN PGP MESSAGE-----
{BASE64} {BASE64}
-----END PGP MESSAGE----- -----END PGP MESSAGE-----
TEXT; TEXT;
$base64_string = base64_encode(hex2bin($res['pg_crypt_text'])); $base64_string = base64_encode(hex2bin($res['pg_crypt_text']) ?: '');
$encryptedMessage = str_replace( $encryptedMessage = str_replace(
'{BASE64}', '{BASE64}',
$base64_string, $base64_string,
@@ -159,9 +159,7 @@ try {
} catch (\Exception $e) { } catch (\Exception $e) {
print "Error decrypting message: " . $e->getMessage() . "<br>"; print "Error decrypting message: " . $e->getMessage() . "<br>";
} }
}
// do compare for PHP and pgcrypto settings
print "</body></html>"; print "</body></html>";