Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Alpha and beta releases sort above the final release

已關閉 適合新手
#58 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
74/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
php
領域
cli

研究方向

排序邏輯位於 src/Repository/ReleasesCollection.php 中的 comparisonVersionString(),它會把 -beta.1 這類後綴改寫為數字部分,接著 version_compare() 會錯誤地排序。請先從 ReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease 中移除 #[Skip],然後執行 vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease。當該測試通過,且正式版本排在 rc、beta 和 alpha 之上(包括大寫的 -RC)時即完成。請先查看 #49,因為替換版本查找方式可能會刪除這段程式碼。

由索引模型根據 Issue 內容生成。

描述

bug

Description

ReleasesCollection::sortByVersion() ranks alpha and beta pre-releases above the final release of the same version. Sorting v2024.1.0-alpha.1, v2024.1.0, v2024.1.0-beta.1, v2024.1.0-rc.1 gives:

v2024.1.0-beta.1
v2024.1.0-alpha.1
v2024.1.0
v2024.1.0-rc.1

Expected: v2024.1.0, v2024.1.0-rc.1, v2024.1.0-beta.1, v2024.1.0-alpha.1.

get-binary and download-protoc-binary install the first release of the sorted list that passes the stability filter. With --stability=beta (or lower) they pick the beta over the final release that is already out.

comparisonVersionString() replaces -<stability> with .<weight>.. v2024.1.0-beta.1 therefore compares as v2024.1.0.2..1, and version_compare() ranks it above v2024.1.0 because it has more numeric parts. Lower-case -rc tags are left untouched (the stability is RC), so they happen to sort correctly. Upper-case -RC tags have the same problem as beta and alpha. #2 was about the order among pre-releases.

Steps to reproduce

  1. Remove #[Skip] from ReleasesCollectionTest::sortByVersionPutsPreReleasesBelowFinalRelease.
  2. Run vendor/bin/testo --filter=sortByVersionPutsPreReleasesBelowFinalRelease.

Additional context

The release lookup may be replaced by DLoad in #49, in which case this code goes away.

主要語言
PHP
星號
30
分支
15
平均合併
9 小時 37 分鐘
30 天內合併 PR
16

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

roadrunner-php/cli 的其他 Issue

查看 roadrunner-php/cli 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。