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

Commit c5bd038

Browse files
committed
resolved potential undefined variable errors
1 parent 6c36b91 commit c5bd038

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/phpFITFileAnalysis.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,9 @@ private function readHeader()
904904
*/
905905
private function readDataRecords()
906906
{
907-
$record_header_byte;
908-
$message_type;
909-
$local_mesg_type;
907+
$record_header_byte = 0;
908+
$message_type = 0;
909+
$local_mesg_type = 0;
910910

911911
while ($this->file_header['header_size'] + $this->file_header['data_size'] > $this->file_pointer) {
912912
$record_header_byte = ord(substr($this->file_contents, $this->file_pointer, 1));
@@ -1202,8 +1202,6 @@ private function interpolateMissingData(&$missing_keys, &$array)
12021202
}
12031203

12041204
$num_points = 2;
1205-
$prev_value;
1206-
$next_value;
12071205

12081206
$min_key = min(array_keys($array));
12091207
$max_key = max(array_keys($array));
@@ -1219,11 +1217,11 @@ private function interpolateMissingData(&$missing_keys, &$array)
12191217
continue;
12201218
}
12211219

1222-
reset($array);
1220+
$prev_value = $next_value = reset($array);
12231221

12241222
while ($missing_keys[$i] > key($array)) {
12251223
$prev_value = current($array);
1226-
next($array);
1224+
$next_value = next($array);
12271225
}
12281226
for ($j=$i+1; $j<count($missing_keys); ++$j) {
12291227
if ($missing_keys[$j] < key($array)) {
@@ -1232,7 +1230,7 @@ private function interpolateMissingData(&$missing_keys, &$array)
12321230
break;
12331231
}
12341232
}
1235-
$next_value = current($array);
1233+
12361234
$gap = ($next_value - $prev_value) / $num_points;
12371235

12381236
for ($k=0; $k<=$num_points-2; ++$k) {

0 commit comments

Comments
 (0)