4 ms·
A badly coded website could go in the other direction, eg in JS, someone writes a poor string equality check: function normalise(s) { return (s + "
by DougBTX 10y ago
A badly coded website could go in the other direction, eg in JS, someone writes a poor string equality check:
function normalise(s) {
return (s + "").toLowerCase();
}
function isEqual(a, b) {
return normalise(a) == normalise(b);
}
And then someone else uses it in some form validation logic:
if (isEqual(surname, null)) {
return error;
}
- jerf 10y agoThen as the next step, some programmer somewhere notices that all the NULLs in the database have been converted into strings somewhere, and puts UPDATE table SET column = NULL WHERE column = "NULL" somewhere, maybe even in a trigger, and that's that. The problem with data destruction is that only one thing in the entire data pipeline has to spuriously map two distinct values to the same output value, and the data is destroyed and can not be recovered. Very few programmers think carefully about whether a serialization or data transfer format maps every single possible input to a different output. It may only take one oversight to ruin your year.