adriangibbons / php-fit-file-analysis

A PHP class for analysing FIT files created by Garmin GPS devices
MIT License
124 stars 49 forks source link

Undefined offset: 25 in phpFITFileAnalysis.php on line 1228 #49

Open OlafvdSpek opened 6 years ago

OlafvdSpek commented 6 years ago
1228: $this->types = $this->endianness[$architecture];

Undefined offset: 25 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 139 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 97 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 113 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 119 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 109 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
Undefined offset: 108 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1228
OlafvdSpek commented 6 years ago
array_unique() expects parameter 1 to be array, integer given in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1535
adriangibbons commented 6 years ago

Hi @OlafvdSpek - obviously something is going quite horribly wrong! The $architecture should only be 0 or 1 for big or little-endianess.

Are you able to share a FIT file where this is happening? What type of activity and what device have you used to record it?

Cheers, Adrian.

OlafvdSpek commented 6 years ago

Sure, what's your email address?

adriangibbons commented 6 years ago

You can save a file as a .TXT and upload it here if that works? Cheers

OlafvdSpek commented 6 years ago

I'd like the file to stay (semi) private..

OlafvdSpek commented 5 years ago

Hi Adrian,

Any luck?

OlafvdSpek commented 5 years ago

@adriangibbons Ping ;)

adriangibbons commented 4 years ago

Hi @OlafvdSpek

Are you still having issues? You'd shared two files with me via email:

garmin.fit As discussed via email, neither of us is able to reproduce the error and everything seems OK.

1.fit This doesn't seem like an activity is recorded in the file (which is only 494 bytes) - maybe something went wrong when recording this.

This is confirmed if I upload to Strava:

Screen Shot 2019-10-05 at 10 43 54 am

OlafvdSpek commented 4 years ago
$ php test-fit.php 1.fit 
PHP Warning:  array_unique() expects parameter 1 to be array, integer given in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1543

Warning: array_unique() expects parameter 1 to be array, integer given in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1543
$ php test-fit.php 2.fit  
PHP Notice:  Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232

Notice: Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232
PHP Notice:  Undefined offset: 73 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232

Notice: Undefined offset: 73 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232
PHP Notice:  Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232

Notice: Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232
PHP Notice:  Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232

Notice: Undefined offset: 14 in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 1232
PHP Fatal error:  Uncaught Error: Unsupported operand types in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php:2720
Stack trace:
#0 vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php(1143): adriangibbons\phpFITFileAnalysis->processHrMessages()
#1 test-fit.php(6): adriangibbons\phpFITFileAnalysis->__construct('2.fit')
#2 {main}
  thrown in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 2720

Fatal error: Uncaught Error: Unsupported operand types in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php:2720
Stack trace:
#0 vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php(1143): adriangibbons\phpFITFileAnalysis->processHrMessages()
#1 test-fit.php(6): adriangibbons\phpFITFileAnalysis->__construct('2.fit')
#2 {main}
  thrown in vendor/adriangibbons/php-fit-file-analysis/src/phpFITFileAnalysis.php on line 2720
$ composer info
adriangibbons/php-fit-file-analysis v3.2.2 A PHP class for analysing FIT files created by Garmin GPS devices
$ md5sum *.fit
acc6b419f903165f9a6cc4dd8e8a60d2  1.fit
60df7628d0105886a16f63dfcfdc846c  2.fit
c4b2b452ad461e1415b6f337d3e4523b  issue-49.fit
$ cat test-fit.php 
<?php
require __DIR__ . '/vendor/autoload.php';

// echo $_SERVER['argv'][1], ":\n";

new adriangibbons\phpFITFileAnalysis($_SERVER['argv'][1]);
$ php --version
PHP 7.0.33-11+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Sep  2 2019 13:31:10) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.0.33-11+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2017, by Zend Technologies
    with blackfire v1.27.1~linux-x64-non_zts70, https://blackfire.io, by Blackfire
OlafvdSpek commented 4 years ago

This doesn't seem like an activity is recorded in the file (which is only 494 bytes) - maybe something went wrong when recording this.

Hi Adrian,

Maybe, but shouldn't the lib be able to handle that without PHP warnings? I've emailed you 2.fit, a file that causes other warnings / errors. Let me know if you can reproduce them.

adriangibbons commented 4 years ago

Just made a quick commit that should fix the issue with 1.fit Family, work, life, other projects have been preventing me from progressing the other issues.

OlafvdSpek commented 4 years ago

Thanks!