Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Commit

Permalink
prevent deprecation notice in PHP 8.0 and above
Browse files Browse the repository at this point in the history
  • Loading branch information
yahesh committed Jul 20, 2022
1 parent 50b7e0e commit 412102d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.30b2 (2022-07-20)

* prevent deprecation notice in PHP 8.0 and above

# 0.30b1 (2022-02-01)

* specify columns on insert to be more robust regarding schema changes (thanks to @jonico)
Expand Down
9 changes: 6 additions & 3 deletions actions/read.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ function read_secret($secret, &$error = null) {
try {
$decrypted_secret = decrypt_v01($secret, $recipients, $decrypt_error, $keyid, $fingerprint);
} finally {
$keys = array_keys($recipients);
foreach ($keys as $key) {
openssl_pkey_free($recipients[$key]);
# prevent deprecation notice in PHP 8.0 and above
if (0 > version_compare(PHP_VERSION, "8.0.0")) {
$keys = array_keys($recipients);
foreach ($keys as $key) {
openssl_pkey_free($recipients[$key]);
}
}

zeroize_array($recipients);
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

# Shared-Secrets v0.30b1
# Shared-Secrets v0.30b2
#
# Copyright (c) 2016-2022, SysEleven GmbH
# All rights reserved.
Expand Down
5 changes: 4 additions & 1 deletion lib/shared-secrets.exec.php
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,10 @@ function open_pubkey($string) {
}
}
} finally {
openssl_pkey_free($privkey);
# prevent deprecation notice in PHP 8.0 and above
if (0 > version_compare(PHP_VERSION, "8.0.0")) {
openssl_pkey_free($privkey);
}
}
}

Expand Down

0 comments on commit 412102d

Please sign in to comment.