Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit aaa717d

Browse files
committed
data_size fix
Issue appeared with introduction of HR buffered messages on latest Fenix watch. e.g. HR for swims.
1 parent c86f8f2 commit aaa717d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/phpFITFileAnalysis.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,8 @@ private function readHeader()
11591159
}
11601160

11611161
if (strlen($this->file_contents) - $header_size - 2 !== $this->file_header['data_size']) {
1162-
throw new \Exception('phpFITFileAnalysis->readHeader(): file_header[\'data_size\'] does not seem correct!');
1162+
// Overwrite the data_size. Seems to be incorrect if there are buffered messages e.g. HR records.
1163+
$this->file_header['data_size'] = $this->file_header['crc'] - $header_size + 2;
11631164
}
11641165
}
11651166

0 commit comments

Comments
 (0)