Merge pull request #3 from Rodots/patch-1

兼容PHP 8.2
This commit is contained in:
Leo 2022-12-07 14:23:47 +08:00 committed by GitHub
commit 7c76c1ddc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,7 +129,7 @@ class XdbSearcher
// read the vector index block // read the vector index block
$buff = $this->read(self::HeaderInfoLength + $idx, 8); $buff = $this->read(self::HeaderInfoLength + $idx, 8);
if ($buff === null) { if ($buff === null) {
throw new \Exception("failed to read vector index at ${idx}"); throw new \Exception("failed to read vector index at {$idx}");
} }
$sPtr = self::getLong($buff, 0); $sPtr = self::getLong($buff, 0);
@ -150,7 +150,7 @@ class XdbSearcher
// read the segment index // read the segment index
$buff = $this->read($p, self::SegmentIndexSize); $buff = $this->read($p, self::SegmentIndexSize);
if ($buff == null) { if ($buff == null) {
throw new \Exception("failed to read segment index at ${p}"); throw new \Exception("failed to read segment index at {$p}");
} }
$sip = self::getLong($buff, 0); $sip = self::getLong($buff, 0);
@ -268,11 +268,11 @@ class XdbSearcher
// return the decoded header info // return the decoded header info
return [ return [
'version' => self::getShort($buff, 0), 'version' => self::getShort($buff, 0),
'indexPolicy' => self::getShort($buff, 2), 'indexPolicy' => self::getShort($buff, 2),
'createdAt' => self::getLong($buff, 4), 'createdAt' => self::getLong($buff, 4),
'startIndexPtr' => self::getLong($buff, 8), 'startIndexPtr' => self::getLong($buff, 8),
'endIndexPtr' => self::getLong($buff, 12) 'endIndexPtr' => self::getLong($buff, 12)
]; ];
} }