Fix pfSense 23.01 / PHP8 fatal error

This commit is contained in:
Ely Deckers 2023-03-03 11:39:22 +01:00
parent fbd6a363af
commit 13b3156c27
2 changed files with 4 additions and 6 deletions

View File

@ -1116,7 +1116,7 @@ function pfz_get_cert_date($valuekey){
global $config;
// Contains a list of refs that were revoked and should not be considered
$revoked_cert_refs;
$revoked_cert_refs = [];
foreach ($config["crl"] as $crl) {
foreach ($crl["cert"] as $revoked_cert) {
$revoked_cert_refs[] = $revoked_cert["refid"];
@ -1129,7 +1129,7 @@ function pfz_get_cert_date($valuekey){
case "validFrom.max":
foreach ($config[$cert_type] as $cert) {
if ( ! in_array($cert['refid'], $revoked_cert_refs) ) {
$certinfo = openssl_x509_parse(base64_decode($cert[crt]));
$certinfo = openssl_x509_parse(base64_decode($cert["crt"]));
if ($value == 0 or $value < $certinfo['validFrom_time_t']) $value = $certinfo['validFrom_time_t'];
}
}
@ -1137,7 +1137,7 @@ function pfz_get_cert_date($valuekey){
case "validTo.min":
foreach ($config[$cert_type] as $cert) {
if ( ! in_array($cert['refid'], $revoked_cert_refs) ) {
$certinfo = openssl_x509_parse(base64_decode($cert[crt]));
$certinfo = openssl_x509_parse(base64_decode($cert["crt"]));
if ($value == 0 or $value > $certinfo['validTo_time_t']) $value = $certinfo['validTo_time_t'];
}
}

View File

@ -135,8 +135,6 @@ const CARP_RES = [
// Abstract undefined symbols and globals from code
class PfEnv
{
public const CRT = crt;
public static function cfg()
{
global $config;
@ -1063,7 +1061,7 @@ class Command
$all_certs = Util::array_flatten($certs_and_cas);
return Util::result(array_reduce($all_certs, function ($value, $certificate) use ($field) {
$cert_info = openssl_x509_parse(base64_decode($certificate[PfEnv::CRT]));
$cert_info = openssl_x509_parse(base64_decode($certificate["crt"]));
if ($value == 0 || $value < $cert_info[$field]) {
return $cert_info[$field];