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

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
92/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php
领域
devtools

调研方向

阅读 hooks/post_install.lua 第 215–220 行附近的内容,并检查 Composer 安装程序在 SHA-384 验证前是如何保存的。Issue 指出,util.write_binary_file 是保留安装程序字节内容的现有方法。校验和通过且 Composer 在 Windows 上成功安装,并且验证仍处于启用状态,即表示完成。

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

描述

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.

主要语言
Lua
星标
21
派生
12
平均合并
3 小时 16 分钟
30 天内合并 PR
10

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

相似的 Issue

更多 Lua Issue

把新 issue 发到你的邮箱

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