diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a5fa3ad4..3830e9fd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -20,6 +20,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" steps: - name: "Checkout" @@ -151,6 +152,7 @@ jobs: - "8.1" - "8.2" - "8.3" + - "8.4" steps: - name: "Checkout" @@ -205,7 +207,7 @@ jobs: strategy: fail-fast: true matrix: - php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3'] + php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] steps: - name: Checkout diff --git a/phpunit-windows.xml b/phpunit-windows.xml index 0efef1d0..ac9f211c 100644 --- a/phpunit-windows.xml +++ b/phpunit-windows.xml @@ -1,6 +1,6 @@ - + src diff --git a/phpunit.xml b/phpunit.xml index 3feaa53c..3eb1ce55 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ - + src diff --git a/src/Smalot/PdfParser/Font.php b/src/Smalot/PdfParser/Font.php index af2d0f9f..56dee588 100644 --- a/src/Smalot/PdfParser/Font.php +++ b/src/Smalot/PdfParser/Font.php @@ -287,8 +287,13 @@ public function calculateTextWidth(string $text, ?array &$missing = null): ?floa // Usually, Widths key is set in $details array, but if it isn't use an empty array instead. $widths = $details['Widths'] ?? []; - // Widths array is zero indexed but table is not. We must map them based on FirstChar and LastChar - $width_map = array_flip(range($details['FirstChar'], $details['LastChar'])); + /* + * Widths array is zero indexed but table is not. We must map them based on FirstChar and LastChar + * + * 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 = null; $missing = [];