Skip to content

Commit c28fb8b

Browse files
committed
Accept authors with empty name/email
1 parent 6d11be8 commit c28fb8b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Package/PHP/Util/XML/Loader.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,19 @@ public function load($path, $versionOverride = null)
100100
$package['authors'] = [];
101101

102102
foreach ($authors as $author) {
103-
$package['authors'][] = [
104-
'name' => (string) $author->name,
105-
'email' => (string) $author->email,
103+
$tmp = [
104+
'name' => trim((string) $author->name),
105+
'email' => trim((string) $author->email),
106106
];
107+
if ($tmp['name'] === '') {
108+
unset($tmp['name']);
109+
}
110+
if ($tmp['email'] === '') {
111+
unset($tmp['email']);
112+
}
113+
if ($tmp !== []) {
114+
$package['authors'][] = $tmp;
115+
}
107116
}
108117
}
109118

0 commit comments

Comments
 (0)