Skip to content

Commit cdb17fa

Browse files
committed
fix: revent warning when haven't names
Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent 16fc75e commit cdb17fa

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

lib/Controller/AdminController.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ private function generateCertificate(
125125
array $properties = [],
126126
): AEngineHandler {
127127
$names = [];
128-
foreach ($rootCert['names'] as $item) {
129-
if (empty($item['id'])) {
130-
throw new LibresignException('Parameter id is required!', 400);
128+
if (isset($rootCert['names'])) {
129+
foreach ($rootCert['names'] as $item) {
130+
if (empty($item['id'])) {
131+
throw new LibresignException('Parameter id is required!', 400);
132+
}
133+
$names[$item['id']]['value'] = $this->trimAndThrowIfEmpty($item['id'], $item['value']);
131134
}
132-
$names[$item['id']]['value'] = $this->trimAndThrowIfEmpty($item['id'], $item['value']);
133135
}
134136
$this->installService->generate(
135137
$this->trimAndThrowIfEmpty('commonName', $rootCert['commonName']),

0 commit comments

Comments
 (0)