From c650d574011af4d5b1a8241554f72d0f771dbd90 Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Mon, 20 Feb 2023 17:10:06 +0100 Subject: [PATCH] fix eof detection for PHP 7+. fix #168 --- src/PHPCR/Util/CND/Reader/BufferReader.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/PHPCR/Util/CND/Reader/BufferReader.php b/src/PHPCR/Util/CND/Reader/BufferReader.php index e9b8d0b5..e38c00df 100644 --- a/src/PHPCR/Util/CND/Reader/BufferReader.php +++ b/src/PHPCR/Util/CND/Reader/BufferReader.php @@ -114,8 +114,9 @@ public function currentChar() */ public function isEof() { - return $this->currentChar() === $this->getEofMarker() - || $this->currentChar() === false + $currentChar = $this->currentChar(); + // substr after end of string returned false in PHP 5 and returns '' since PHP 7 + return in_array($currentChar, [$this->getEofMarker(), false, ''], true) || $this->startPos > strlen($this->buffer) || $this->forwardPos > strlen($this->buffer); }