Easy to reproduce bug with Table with "border-collapse: collapse" and a TD colspan with packTableData = true
Maintainer thường phản hồi trong vòng 5 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
The failure is the PHP 8 warning "Trying to access array offset on value of type int" at src/Mpdf.php around line 21537, and it only occurs when packTableData is on, border-collapse: collapse is set, and a cell has colspan. Start by reproducing with the HTML and PHP from the issue on PHP 8, then trace how the table packing code indexes cell data for spanned cells. Done means the snippet renders without the warning and the output matches the PHP 7.3 result. The issue has no comments and no maintainer response after about 1,286 days, so confirm the behaviour is still present on the current development branch first.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Guidelines
- I understand that if I fail to provide all required details, this issue may be closed without review.
Description of the bug
Hello, I was running this code with PHP 7.3 without problem.
I made a small upgrade to PHP 8.0.28 (and upgraded to mPDF 8.1.4) and now this code fails.
Error thrown: Trying to access array offset on value of type int
Happens at: mpdf\mpdf\src\Mpdf.php:21537

Important note:
If I remove: $mpdf->packTableData = true; (works)
If I remove border-collapse: collapse; in <style> tag (works)
If I remove colspan="2" (works)
If 3 are present: fails
mPDF version
8.1.4
PHP Version and environment (server type, cli provider etc., enclosing libraries and their respective versions)
Apache/2.4.54 (Win64) PHP/8.0.26 (also fails on PHP 8.0.28). GD: bundled (2.1.0 compatible), MBSTRING: libmbfl version 1.3.2/ Multibyte regex 6.9.7
Reproducible PHP+CSS+HTML snippet suffering by the error
PHP CODE
$mpdf = new mPDF();
$mpdf->packTableData = true;
$mpdf->WriteHTML($html);
HTML CODE:
<html>
<head>
<style type="text/css">
table {
border-collapse: collapse;
}
</style>
</head>
<body>
<table>
<tr>
<th>Thead1</th>
<th>Thead2</th>
<th>Thead3</th>
</tr>
<tr>
<td colspan="2">Td1</td>
<td>Td2 and Td3</td>
</tr>
</table>
</body>
</html>
- Ngôn ngữ chính
- PHP
- Star
- 4.7k
- Fork
- 1.1k
- Merge trung bình
- 6 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của mpdf/mpdf
-
SVG path arcs with an explicit zero radius throw DivisionByZeroErrorCó thể đã có người làm @Syed-Shehroz-Sohail đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Closing a column set with an image in it leaves the cursor below the page, wasting the rest of itĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 5 ngày
-
8.3: Local fallback for external stylesheets is inverted in CssLoader (basepathIsLocal check negated) — CSS silently dropped when remote fetch failsCó thể đã có người làm @hemreduru đã nhận 12 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 5 ngày
-
Tag/Td.php silently clears cell top/bottom borders when a row has a partial border (plus two warnings and a deprecation)Có thể đã có người làm @alizamani1616 đã nhận 61 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 5 ngày
-
AdjustHTML() collapses multiple spaces inside quoted attribute values (src, href)Có thể đã có người làm @sornapudisuresh đã nhận 130 ngày trước. Đang mởbug/fix help wanted HTML/CSS support
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
mpdf/mpdf#2208 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 5 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Перевод устарел
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày