1
0
mirror of https://github.com/danog/phpseclib.git synced 2024-12-04 18:48:24 +01:00

X509: tweaks to mapOutExtensions

This commit is contained in:
terrafrost 2021-04-20 16:01:45 -05:00
parent c596078d7a
commit 7d3b0a2182

View File

@ -670,7 +670,7 @@ class X509
*/
private function mapOutExtensions(&$root, $path)
{
$extensions = &$this->subArray($root, $path, true);
$extensions = &$this->subArray($root, $path, !empty($this->extensionValues));
foreach ($this->extensionValues as $id => $data) {
extract($data);
@ -679,16 +679,15 @@ class X509
'extnValue' => $value,
'critical' => $critical
];
if (!$replace) {
$extensions[] = $newext;
continue;
}
foreach ($extensions as $key => $value) {
if ($value['extnId'] == $id) {
$extensions[$key] = $newext;
break;
}
if ($replace) {
foreach ($extensions as $key => $value) {
if ($value['extnId'] == $id) {
$extensions[$key] = $newext;
continue 2;
}
}
}
$extensions[] = $newext;
}
if (is_array($extensions)) {