Skip to content

Commit

Permalink
Merge pull request #227 from mlocati/empty-emails
Browse files Browse the repository at this point in the history
Support package.xml files with empty author emails
  • Loading branch information
mlocati authored Feb 22, 2021
2 parents 70fb1b9 + c28fb8b commit 7db8ffe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions features/pecl/install-extensions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Feature: download and install PECL extensions
| apc | APC |
| apcu | apcu |
| mongo | mongo |
| tensor | tensor |
| zstd | zstd |

Scenario Outline: Does NOT install extensions from PECL repository having wrong version in source code
Expand Down
15 changes: 12 additions & 3 deletions src/Package/PHP/Util/XML/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,19 @@ public function load($path, $versionOverride = null)
$package['authors'] = [];

foreach ($authors as $author) {
$package['authors'][] = [
'name' => (string) $author->name,
'email' => (string) $author->email,
$tmp = [
'name' => trim((string) $author->name),
'email' => trim((string) $author->email),
];
if ($tmp['name'] === '') {
unset($tmp['name']);
}
if ($tmp['email'] === '') {
unset($tmp['email']);
}
if ($tmp !== []) {
$package['authors'][] = $tmp;
}
}
}

Expand Down
Binary file added tests/pecl-website/assets/tensor-2.1.4.tgz
Binary file not shown.
1 change: 1 addition & 0 deletions tests/pecl-website/web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ static function ($errno, $errstr, $errfile, $errline): void {
'/get/oci8/2.0.8' => "{$assetsDir}/oci8-2.0.8.tgz",
'/get/sqlsrv' => "{$assetsDir}/sqlsrv-5.9.0beta2.tgz",
'/get/swoole' => "{$assetsDir}/swoole-4.6.2.tgz",
'/get/tensor' => "{$assetsDir}/tensor-2.1.4.tgz",
'/get/yaml' => "{$assetsDir}/yaml-2.2.1.tgz",
'/get/zstd' => "{$assetsDir}/zstd-0.10.0.tgz",
];
Expand Down

0 comments on commit 7db8ffe

Please sign in to comment.