Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#1,771 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
83/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
php
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu bằng cách tìm lệnh php:install và so sánh tham số phiên bản của lệnh này với tham số phpVersion của lệnh php:update, như được mô tả trong issue. Kiểm tra phần trợ giúp của lệnh và tái hiện bằng herd php:install 8.4 để xác nhận tham số bị bỏ qua. Công việc hoàn tất khi lệnh cài đặt phiên bản được yêu cầu mà không hỏi; hãy kiểm tra hành vi tương tác và không tương tác.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
Không có dữ liệu ngôn ngữ
Star
124
Fork
1
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của beyondcode/herd-community

Tất cả issue của beyondcode/herd-community

Issue tương tự

Thêm issue về CLI

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.