diff options
| author | Rico Sonntag <mail@ricosonntag.de> | 2026-05-01 10:37:13 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-01 09:37:13 +0100 |
| commit | 6de0cbdb27dc681040a6b2a8cc20a9ec2d82a582 (patch) | |
| tree | 18c1115fe08ff4f2bc4bf4bb691a8c17d04bb24b | |
| parent | c8dacd48d5eb333becff516fe4b183f162140d6d (diff) | |
| download | webtrees-6de0cbdb27dc681040a6b2a8cc20a9ec2d82a582.tar.gz webtrees-6de0cbdb27dc681040a6b2a8cc20a9ec2d82a582.tar.bz2 webtrees-6de0cbdb27dc681040a6b2a8cc20a9ec2d82a582.zip | |
Fix: tree CLI command cannot find existing trees (#5370)
The TreeEdit command (`tree --delete`, `tree --title`) always failed
with "Tree '<name>' does not exist.", because the tree lookup used the
literal string 'name' as the collection key instead of the $name
argument value:
$tree = $this->tree_service->all()->get('name');
Replace with the variable so the lookup works as intended:
$tree = $this->tree_service->all()->get($name);
Reproduce on main:
php index.php tree --create --title=Demo demo
php index.php tree --delete demo
# → [ERROR] Tree 'demo' does not exist.
`tree --create` was unaffected because its happy path does not depend
on the lookup result.
| -rw-r--r-- | app/Cli/Commands/TreeEdit.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/Cli/Commands/TreeEdit.php b/app/Cli/Commands/TreeEdit.php index 8fdb6f1855..e2d62ae326 100644 --- a/app/Cli/Commands/TreeEdit.php +++ b/app/Cli/Commands/TreeEdit.php @@ -73,7 +73,7 @@ final class TreeEdit extends AbstractCommand return Command::INVALID; } - $tree = $this->tree_service->all()->get('name'); + $tree = $this->tree_service->all()->get($name); if ($create) { if ($tree instanceof Tree) { |
