Windows: Composer installer checksum fails because installer is written in text mode

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

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
92/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
devtools

Hướng nghiên cứu

Đọc hooks/post_install.lua quanh các dòng 215–220 và kiểm tra cách trình cài đặt Composer được lưu trước khi xác minh SHA-384. Issue chỉ ra util.write_binary_file là cách hiện có để giữ nguyên các byte của trình cài đặt. Công việc hoàn tất khi checksum hợp lệ và Composer được cài đặt trên Windows, với tính năng xác minh vẫn được bật.

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

Mô tả

Description

Installing PHP on Windows through mise fails during Composer installation. The PHP archive downloads and extracts successfully, but verification of the Composer installer fails.

Environment
  • Windows x64, PowerShell
  • mise 2026.11.15 windows-x64 (2026-11-29)
  • Plugin commit: aa2922170710cfe4d7277cca4324cf1d38b4efc8
  • Requested PHP version: 8.6.0
Steps to reproduce

With the unmodified plugin at the commit above, run:

mise use vfox:version-fox/[email protected]
Actual behavior

Installation aborts with:

The Composer installer does not match the sha384 that Composer publishes;
Composer was not installed.
Expected behavior

The downloaded installer should retain its original bytes, pass SHA-384 verification and install Composer.

Cause and proposed fix

In hooks/post_install.lua, the installer is saved using util.write_file, which opens the file in text mode. On Windows, this converts LF line endings to CRLF and changes the checksum.

The plugin already provides util.write_binary_file, which preserves the downloaded bytes.

-    _, err = util.write_file(setup, installer)
+    _, err = util.write_binary_file(setup, installer)
Validation

After applying only this change locally and retrying:

  • Composer’s existing SHA-384 verification passed.
  • PHP installation completed.
  • mise exec -- php -v reported PHP 8.6.0.
  • mise exec -- composer --version reported Composer 2.11.3.

Checksum verification remained enabled.

Ngôn ngữ chính
Lua
Star
21
Fork
12
Merge trung bình
3 giờ 16 phút
Pull request đã merge (30 ngày)
10

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

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

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 tương tự

Thêm issue về Lua

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.