From 87334e43c02b4c480ef9a131302a7a56fe599163 Mon Sep 17 00:00:00 2001 From: Alexey Soltan Date: Tue, 23 Sep 2025 11:25:28 +0300 Subject: [PATCH] Fix undefined keys error Error Undefined array keys"FirstChar" and "LastChar" --- src/Smalot/PdfParser/Font.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Smalot/PdfParser/Font.php b/src/Smalot/PdfParser/Font.php index 8e1fbce1..ee2f8305 100644 --- a/src/Smalot/PdfParser/Font.php +++ b/src/Smalot/PdfParser/Font.php @@ -301,7 +301,7 @@ public function calculateTextWidth(string $text, ?array &$missing = null): ?floa * Note: Without the change you would see warnings in PHP 8.4 because the values of FirstChar or LastChar * can be null sometimes. */ - $width_map = array_flip(range((int) $details['FirstChar'], (int) $details['LastChar'])); + $width_map = array_flip(range((int) ($details['FirstChar'] ?? 0), (int) ($details['LastChar'] ?? 0))); $width = null; $missing = [];