From 0172714a3173b8ec80609529381b81c6ff2e5c06 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Thu, 3 Sep 2026 04:03:04 +0200 Subject: [PATCH] Fix `spl_object_hash` deprecation on PHP 8.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When testing with PHP 8.6.0beta2, I get the following deprecation warning: Function spl_object_hash() is deprecated since 8.6, consider using spl_object_id() instead Let’s switch to the suggested function where supported. https://www.php.net/manual/en/function.spl-object-hash.php https://www.php.net/manual/en/function.spl-object-id.php --- src/Smalot/PdfParser/PDFObject.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Smalot/PdfParser/PDFObject.php b/src/Smalot/PdfParser/PDFObject.php index 378ae15d..3b0e72cd 100644 --- a/src/Smalot/PdfParser/PDFObject.php +++ b/src/Smalot/PdfParser/PDFObject.php @@ -1210,6 +1210,6 @@ public static function factory( */ protected function getUniqueId(): string { - return spl_object_hash($this); + return \PHP_VERSION_ID < 70200 ? \spl_object_hash($this) : (string) \spl_object_id($this); } }