Null and empty strings are not the same thing #1417
adamcameron
started this conversation in
General
Replies: 3 comments 3 replies
|
Yeah wheels 3.x sounds like a good time to address this |
2 replies
|
I'm wondering how this would work.. would any properties not passed in be set to null, or would one need to explicitly pass in every property with it's existing value? |
1 reply
|
I may be wrong here but:
|
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
We've just fallen foul of this:
To quote John McEnroe: "You cannot be serious".
I would request - with all due respect - that in CFWheels 3.x that you get rid of this "less than ideal" design decision.
CFML might not handle null values as well as it perhaps could (partial Lucee implementations notwithstanding), but databases and the real world do. Empty strings are not the equivalent of nulls, and are entirely valid values to store in a non-nullable field.
If CFWheels wants to implement storage tier handling between app code and the the DB, then it's actually its job to deal with stuff like this. that's what it's for. Not go "erm... tricky... let's pretend they're the same".
I can't really see how it would be so difficult. Property set to an empty string? It's an empty string. Property not set at all. Null. [shrug]. This is - indeed - how CFML has always dealt with this (at least as far back as CF10...): https://trycf.com/gist/d42f20da49016ebabf2de32d6d35ea42/acf?theme=monokai
Tangential:
There's no need to support any version of CF older than 2021. Even Adobe doesn't support versions older than that (extended support for 2018 ends in July 2024). Lucee doesn't even actively support Lucee 5 any more, so you only really need to target Lucee 6 there.
Don't burden yourself with "but lots of ppl use unsupported versions...". Yes. Unsupported. Without support. You don't need to support them. It's on them to deal with that, not you ;-)
All reactions