diff options
author | jim-p <jimp@pfsense.org> | 2011-05-11 16:12:29 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-05-11 16:12:29 -0400 |
commit | 4bc2c6766e2782aad63120f2c5f77d306fb7609f (patch) | |
tree | 5be106361eb3647871c5a75f7c9f167a09157ac2 | |
parent | 728003c8934207a87e7c32a0aa2caecccf3ff8c1 (diff) | |
download | pfsense-4bc2c6766e2782aad63120f2c5f77d306fb7609f.zip pfsense-4bc2c6766e2782aad63120f2c5f77d306fb7609f.tar.gz |
Test for array/size before foreach
-rw-r--r-- | etc/inc/certs.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/etc/inc/certs.inc b/etc/inc/certs.inc index e62719c..357ac05 100644 --- a/etc/inc/certs.inc +++ b/etc/inc/certs.inc @@ -485,8 +485,10 @@ function crl_update(& $crl) { $ca_str_crt = base64_decode($ca['crt']); $ca_str_key = base64_decode($ca['prv']); $crl_res = openssl_crl_new($ca_str_crt, $crl['serial'], $crl['lifetime']); - foreach ($crl['cert'] as $cert) { - openssl_crl_revoke_cert($crl_res, base64_decode($cert["crt"]), $cert["revoke_time"], $cert["reason"]); + if (is_array($crl['cert']) && (count($crl['cert']) > 0)) { + foreach ($crl['cert'] as $cert) { + openssl_crl_revoke_cert($crl_res, base64_decode($cert["crt"]), $cert["revoke_time"], $cert["reason"]); + } } openssl_crl_export($crl_res, $crl_text, $ca_str_key); $crl['text'] = base64_encode($crl_text); |