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

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

Đang mở Phù hợp với người mới
#24,441 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

@auraseb đang làm issue này rồi.

Từ ngày 19/10/2026.

  • #24442 của @auraseb — đang mở

Đá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
76/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ệ
c, php
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu với php_quot_print_encode() trong ext/standard/quot_print.c và so sánh cách xử lý ngắt dòng mềm cho các byte từ 0xF5 đến 0xFF với các nhánh hiện có. Kiểm tra các bài kiểm thử quoted-printable liên quan và bổ sung kiểm thử cho một chuỗi các byte này. Công việc được xem là hoàn tất khi các dòng đã mã hóa nằm trong giới hạn 76 ký tự của RFC 2045; issue cho biết bộ lọc luồng không bị ảnh hưởng.

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

Mô tả

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

Ngôn ngữ chính
C
Star
40.4k
Fork
8.2k
Merge trung bình
2 ngày 13 giờ
Pull request đã merge (30 ngày)
171

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

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 php/php-src

Tất cả issue của php/php-src

Issue tương tự

Thêm issue về C

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.