From eb9a523dc5f4f8c6ea16797e98e503302a89f045 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Wed, 1 Apr 2026 12:05:30 -0500 Subject: [PATCH 1/2] Fix regex pattern for trailer extraction --- src/PDFUtilFnc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PDFUtilFnc.php b/src/PDFUtilFnc.php index a92a8e3..3d222ef 100644 --- a/src/PDFUtilFnc.php +++ b/src/PDFUtilFnc.php @@ -41,7 +41,7 @@ class PDFUtilFnc { public static function get_trailer(&$_buffer, $trailer_pos) { // Search for the trailer structure - if (preg_match('/trailer\s+(.*)\s+startxref/ms', $_buffer, $matches, 0, $trailer_pos) !== 1) + if (preg_match('/trailer\s*(.*)\s+startxref/ms', $_buffer, $matches, 0, $trailer_pos) !== 1) return p_error("trailer not found"); $trailer_str = $matches[1]; From 2d6a3e017b2a665786bd028757a55ddb5b762708 Mon Sep 17 00:00:00 2001 From: erikn69 Date: Wed, 1 Apr 2026 12:26:29 -0500 Subject: [PATCH 2/2] Fix regex to match only words --- src/PDFUtilFnc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PDFUtilFnc.php b/src/PDFUtilFnc.php index 3d222ef..4dfdbf4 100644 --- a/src/PDFUtilFnc.php +++ b/src/PDFUtilFnc.php @@ -41,7 +41,7 @@ class PDFUtilFnc { public static function get_trailer(&$_buffer, $trailer_pos) { // Search for the trailer structure - if (preg_match('/trailer\s*(.*)\s+startxref/ms', $_buffer, $matches, 0, $trailer_pos) !== 1) + if (preg_match('/\btrailer\b\s*(.*)\s*\bstartxref\b/ms', $_buffer, $matches, 0, $trailer_pos) !== 1) return p_error("trailer not found"); $trailer_str = $matches[1];