From 498a85ad75d68fde08551a2e4d2b0b81fd9ceec9 Mon Sep 17 00:00:00 2001 From: 8ctopus Date: Thu, 27 Nov 2025 16:00:04 +0400 Subject: [PATCH 1/3] Fix php 8.5 deprecation --- src/FontLib/BinaryStream.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/FontLib/BinaryStream.php b/src/FontLib/BinaryStream.php index cc5e72c..cb2d846 100644 --- a/src/FontLib/BinaryStream.php +++ b/src/FontLib/BinaryStream.php @@ -158,7 +158,13 @@ public function write($data, $length = null) { } public function readUInt8() { - return ord($this->read(1)); + $uint8 = $this->read(1); + + if ($uint8 === '') { + $uint8 = '0'; + } + + return ord($uint8); } public function readUInt8Many($count) { From c4082ca804767bb0dd5de0d97b209682fc6a6588 Mon Sep 17 00:00:00 2001 From: 8ctopus Date: Wed, 7 Jan 2026 09:26:40 +0400 Subject: [PATCH 2/3] Fix read unsigned byte return value when empty string --- src/FontLib/BinaryStream.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FontLib/BinaryStream.php b/src/FontLib/BinaryStream.php index cb2d846..f05c1e0 100644 --- a/src/FontLib/BinaryStream.php +++ b/src/FontLib/BinaryStream.php @@ -161,7 +161,7 @@ public function readUInt8() { $uint8 = $this->read(1); if ($uint8 === '') { - $uint8 = '0'; + return 0; } return ord($uint8); From 87e2ece95659e1196d5c671180b733b507ef1748 Mon Sep 17 00:00:00 2001 From: Brian Sweeney Date: Thu, 8 Jan 2026 09:03:02 -0500 Subject: [PATCH 3/3] Refactor readUInt8 method for clarity --- src/FontLib/BinaryStream.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/FontLib/BinaryStream.php b/src/FontLib/BinaryStream.php index f05c1e0..b6e91b6 100644 --- a/src/FontLib/BinaryStream.php +++ b/src/FontLib/BinaryStream.php @@ -158,13 +158,11 @@ public function write($data, $length = null) { } public function readUInt8() { - $uint8 = $this->read(1); - - if ($uint8 === '') { + $byte = $this->read(1); + if ($byte === '') { return 0; } - - return ord($uint8); + return ord($byte); } public function readUInt8Many($count) {