iftechfoundation / ifdb-suggestion-tracker

Bugs and feature requests for a future IFDB update
10 stars 0 forks source link

IFDB doesn't display the version number "0" #344

Open alice-blue opened 2 years ago

alice-blue commented 2 years ago

Some games have the version number "0" (for example, https://ifdb.org/viewgame?id=b3rd1mfm4zox4eic.) But when you enter "0" as the version number at IFDB, it displays "current version" on the page as "unknown."

jimbonator commented 2 years ago

I suspect the problem stems from the implementation of isEmpty():

// Determine if a value is "empty" - null, false, or an empty string
//
function isEmpty($val) {
    return is_null($val) || $val == false || $val == "";
}

In PHP, 0 == false and 0 == "".

An improved implementation would use strict comparisons:

    return is_null($val) || $val === false || $val === "";

If this change was made, checks would need to be done to ensure it wasn't causing regressions elsewhere.