Skip to content

Commit 87ca0e4

Browse files
committed
Merge branch '6.4' into 7.3
* 6.4: Restore Relay 8.5 test account for PHP_ZTS being a boolean value on PHP 8.4+ [Intl] Update data to ICU 78.1 [Console] Fix exception message when abbreviation matches multiple hidden commands [FrameworkBundle] Fix TypeError when traversing scalar values in debug:config [DependencyInjection] Fix loop corruption in CheckTypeDeclarationsPass [DependencyInjection] Fix invalid PHP syntax for nullable TypedReference in PhpDumper Fix typo in comment [Translation][Routing] Fix typos [String] Fix normalization in trimPrefix/trimSuffix
2 parents 1f04b60 + 18c5fd1 commit 87ca0e4

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

Application.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,9 @@ public function find(string $name): Command
791791
}
792792
}
793793

794-
$command = $this->get(reset($commands));
794+
$command = $commands ? $this->get(reset($commands)) : null;
795795

796-
if ($command->isHidden()) {
796+
if (!$command || $command->isHidden()) {
797797
throw new CommandNotFoundException(\sprintf('The command "%s" does not exist.', $name));
798798
}
799799

Tests/ApplicationTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2601,6 +2601,21 @@ public function testOriginalHandlerRestoredAfterPop()
26012601
$this->assertSame(\SIG_DFL, pcntl_signal_get_handler(\SIGUSR1), 'OS-level handler must remain SIG_DFL after a second run.');
26022602
}
26032603

2604+
public function testFindAmbiguousHiddenCommands()
2605+
{
2606+
$application = new Application();
2607+
2608+
$application->add(new Command('test:foo'));
2609+
$application->add(new Command('test:foobar'));
2610+
$application->get('test:foo')->setHidden(true);
2611+
$application->get('test:foobar')->setHidden(true);
2612+
2613+
$this->expectException(CommandNotFoundException::class);
2614+
$this->expectExceptionMessage('The command "t:f" does not exist.');
2615+
2616+
$application->find('t:f');
2617+
}
2618+
26042619
/**
26052620
* @requires extension pcntl
26062621
*

0 commit comments

Comments
 (0)