From 1ff942bb44dbfe72f55113cbc9feb444be9b52e6 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 24 Feb 2023 17:41:47 +0100 Subject: [PATCH] Fix type errors in key updating logic --- src/Composer/Command/SelfUpdateCommand.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index c9a417669..45db77e52 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -369,6 +369,7 @@ TAGSPUBKEY $io->write('Open https://composer.github.io/pubkeys.html to find the latest keys'); $validator = static function ($value): string { + $value = (string) $value; if (!Preg::isMatch('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) { throw new \UnexpectedValueException('Invalid input'); } @@ -379,7 +380,7 @@ TAGSPUBKEY $devKey = ''; while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) { $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator); - while ($line = $io->ask('')) { + while ($line = $io->ask('', '')) { $devKey .= trim($line)."\n"; if (trim($line) === '-----END PUBLIC KEY-----') { break; @@ -392,7 +393,7 @@ TAGSPUBKEY $tagsKey = ''; while (!Preg::isMatch('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) { $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator); - while ($line = $io->ask('')) { + while ($line = $io->ask('', '')) { $tagsKey .= trim($line)."\n"; if (trim($line) === '-----END PUBLIC KEY-----') { break;