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

quoted_printable_encode() produces lines longer than 76 characters for bytes 0xF5 to 0xFF

未關閉 適合新手
#24,441 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@auraseb 已經在處理了。

開始於 2026年10月19日。

  • #24442 來自 @auraseb —— 未關閉

評估

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

研究方向

從 ext/standard/quot_print.c 中的 php_quot_print_encode() 開始,比較位元組 0xF5 到 0xFF 的軟換行處理與現有分支。檢查相關的 quoted-printable 測試,並為這些位元組連續出現的情況新增測試涵蓋。編碼後的行不超過 RFC 2045 規定的 76 個字元即表示完成;issue 指出串流篩選器不受影響。

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

描述

Description

quoted_printable_encode() is documented to follow RFC 2045 section 6.7, which limits encoded lines to 76 characters. Input bytes in the range 0xF5 to 0xFF are encoded as =XX but never trigger a soft line break, so a run of them ends up on a single line of any length.

The following code:

<?php
$encoded = quoted_printable_encode(str_repeat("\xFF", 30));
var_dump(array_map('strlen', explode("\r\n", $encoded)));

Resulted in this output:

array(1) {
  [0]=>
  int(90)
}

But I expected this output instead:

array(2) {
  [0]=>
  int(76)
  [1]=>
  int(15)
}

The same happens with any binary data that contains such bytes, for example a random string of a few hundred bytes regularly produces 78 or 79 character lines. The convert.quoted-printable-encode stream filter is not affected.

Root cause: in php_quot_print_encode() (ext/standard/quot_print.c) the soft break condition has one branch for bytes up to 0x7F and three branches for UTF-8 lead and continuation bytes (0x80 to 0xDF, 0xE0 to 0xEF, 0xF0 to 0xF4). Bytes 0xF5 to 0xFF match none of them, so the line position keeps growing without a break being inserted.

PHP Version
PHP 8.7.0-dev (master at b7256eee), also present in all supported branches
Operating System

Any

主要語言
C
星號
40.4k
分支
8.2k
平均合併
3 天 3 小時
30 天內合併 PR
173

環境準備

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

從這裡開始

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

php/php-src 的其他 Issue

查看 php/php-src 的全部 Issue

相似的 Issue

更多 C Issue

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

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