JavaScript Error on Version Check
Cleptomania opened this issue · 0 comments
Since moving to version 1.9.1 this has introduced a new point to the version number(e.g. previously it was 1.9, 1.8, 1.7, etc)
In the templates/index.phtml
file there exists some Javascript code to check for the latest version. With this version number in place it throws a JavaScript error in the browser with SyntaxError: Unexpected number
on line 278.
This is because we're trying to represent the version as a number, with more than one decimal place now.
The previous comparison was simply a greater than check, but now with a new point release, it needs to read the version as a string, and individually check each component of the version to really be able to check it.
For me this was a fatal error in Chrome 102.0.5005.61(didn't test other browsers) and caused the entire application to be unable to show cachegrind files. As a stop gap for myself I just threw quotes around the version number such that line 278 becomes
if (data.latest_version>"<?php echo Webgrind_Config::$webgrindVersion?>") {
instead of
if (data.latest_version><?php echo Webgrind_Config::$webgrindVersion?>) {
This fixes the error and causes the application to function properly again, however it does mean that the version check doesn't work, and it will always consider you up to date.