Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f070826

Browse files
authoredFeb 20, 2023
Merge pull request #213 from phpcr/fix-cnd-parser-eof
fix eof detection for PHP 7+
2 parents 02787c8 + c650d57 commit f070826

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed
 

‎src/PHPCR/Util/CND/Reader/BufferReader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@ public function currentChar()
114114
*/
115115
public function isEof()
116116
{
117-
return $this->currentChar() === $this->getEofMarker()
118-
|| $this->currentChar() === false
117+
$currentChar = $this->currentChar();
118+
// substr after end of string returned false in PHP 5 and returns '' since PHP 7
119+
return in_array($currentChar, [$this->getEofMarker(), false, ''], true)
119120
|| $this->startPos > strlen($this->buffer)
120121
|| $this->forwardPos > strlen($this->buffer);
121122
}

0 commit comments

Comments
 (0)
Please sign in to comment.