Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: herd php:install ignores the version argument and asks which version to install

未关闭 适合新手
#1,771 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
83/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
cli

调研方向

首先找到 php:install 命令,并按照 issue 中的描述,将它的版本参数与 php:update 命令的 phpVersion 参数进行比较。查看命令帮助,并使用 herd php:install 8.4 重现问题,以确认该参数被忽略。命令无需提示即可安装所请求的版本时,任务即告完成;验证交互式和非交互式行为。

由索引模型根据 Issue 内容生成。

描述

fixed-in-next-release macOS
Platform

macOS

Operating system version

macOS 27.0.1 (26A434)

System architecture

ARM64 (M1, M2, etc)

Herd Version

2.0.2 (Build: 71)

PHP Version

Not version-specific (global PHP here: 8.5.10)

Bug description

herd php:install 8.4 ignores the 8.4: instead of installing PHP 8.4 it asks "Which PHP version do you want to install?". That is the usage shown in the docs (herd php:install 8.3), in herd list and in herd php:install --help (php:install [<version>]).

In a terminal you can pick the version from the list. Without one (CI, an AI agent, input from a pipe) the command fails with exit code 1 and tells you to "Pass the value as an argument or option instead", although it was passed (log below).

Expected: herd php:install 8.4 installs PHP 8.4 without asking.

Cause, read in herd.phar 2.0.2: Silly's Application::command() merges $input->getOptions() after $input->getArguments(), so Symfony Console's global --version option (false when not given) overwrites the argument that is also named version. php:install is the only Herd command with an argument of that name; php:update [phpVersion] and isolate [phpVersion] are not affected.

Suggestion: rename the argument to phpVersion, as php:update does.

Workaround: install the version in Settings → PHP, or pick it from the list in a terminal.

Steps to reproduce
  1. Herd 2.0.2 with a PHP version that is not installed (here 8.4).
  2. In a terminal, run herd php:install 8.4: it asks which version to install instead of installing 8.4. Press Ctrl-C (nothing is installed).
  3. Without a terminal: herd php:install 8.4 < /dev/null fails with exit code 1.
Relevant log output
$ herd php:install 8.4

 ┌ Which PHP version do you want to install? ───────────────────┐
 │ › ● 8.6                                                    ┃ │
 │   ○ 8.4                                                    │ │
 │   ○ 8.3                                                    │ │
 │   ○ 8.2                                                    │ │
 │   ○ 8.1                                                    │ │
 └──────────────────────────────────────────────────────────────┘
  ⚠ Cancelled.
# (Ctrl-C pressed at the question)

$ herd php:install 8.4 < /dev/null; echo "exit=$?"

In app.php line 92:

  "herd php:install" asked a question but no terminal is attached to answer i
  t. Pass the value as an argument or option instead (see "herd help php:inst
  all").


php:install [<version>]

exit=1
主要语言
没有语言数据
星标
124
派生
1
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

beyondcode/herd-community 的其他 Issue

查看 beyondcode/herd-community 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。