mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-19 11:45:10 +00:00
X509::getChain() should always return array of X509 objects
Due to an early exit optimization, X509::getChain() could return currentCert as an array, instead of X509
This commit is contained in:
parent
2097656b4a
commit
841267aafa
@ -164,7 +164,7 @@ class X509
|
|||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $CAs;
|
private $CAs = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The currently loaded certificate
|
* The currently loaded certificate
|
||||||
@ -2030,9 +2030,6 @@ class X509
|
|||||||
if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
|
if (!is_array($this->currentCert) || !isset($this->currentCert['tbsCertificate'])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (empty($this->CAs)) {
|
|
||||||
return $chain;
|
|
||||||
}
|
|
||||||
while (true) {
|
while (true) {
|
||||||
$currentCert = $chain[count($chain) - 1];
|
$currentCert = $chain[count($chain) - 1];
|
||||||
for ($i = 0; $i < count($this->CAs); $i++) {
|
for ($i = 0; $i < count($this->CAs); $i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user