php-fit-file-analysis icon indicating copy to clipboard operation
php-fit-file-analysis copied to clipboard

[(Probably) since Garmin Edge 1040 Solar Firmware Update] Uncaught TypeError: end(): Argument #1 ($array) must be of type array, null given

Open akberlin opened this issue 10 months ago • 9 comments

Hi Adrian, hi community, seems like Garmin have extended/changed something in the file format with a firmware update. (Or my Edge 1040 Solar is producing crap because of the new firmware. - Not sure actually!) Since then I happen to see these errors when importing FIT-files:

First obstacle was this:

[04-Sep-2023 20:30:59 Europe/Berlin] PHP Fatal error: Uncaught TypeError: end(): Argument #1 ($array) must be of type array, null given in /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php:2478
Stack trace:
#0 /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php(2478): end()
#1 /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php(2653): adriangibbons\phpFITFileAnalysis->isPaused()
#2 /var/www/html/xxx.php(308): adriangibbons\phpFITFileAnalysis->gearChanges()
#3 /var/www/html/xxx.php(68): addGarmin()
#4 /var/www/html/xxx.php(24): addGarminTraining()
#5 {main}
thrown in /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php on line 2478

when commenting out the section about gear changes (don't need them actually anyways) I see the same problem with pauses - but those I'd like to import...

[04-Sep-2023 20:43:16 Europe/Berlin] PHP Fatal error: Uncaught TypeError: end(): Argument #1 ($array) must be of type array, null given in /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php:2478
Stack trace:
#0 /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php(2478): end()
#1 /var/www/html/xxx.php(344): adriangibbons\phpFITFileAnalysis->isPaused()
#2 /var/www/html/xxx.php(68): addGarmin()
#3 /var/www/html/xxx.php(24): addGarminTraining()
#4 {main}
thrown in /var/www/html/_tools/php-FIT-File-Analysis/20200728/src/phpFITFileAnalysis.php on line 2478

My current bypass is using the "Fit File Repair Tool" - which seems to see this assumed file format extension as an error or correctly interprets the existing error and cleans the FIT-file which then runs smoothly.

Would be willing to provide original and repaired files but not as an attachment here... (home address visible)

Adrian, thanks for your superb framework and the support... Regards from Germany Andreas

akberlin avatar Sep 04 '23 18:09 akberlin