coldbox-modules / cborm

The ColdBox ORM enhancements for ColdFusion ORM & Hibernate. Make ORM not suck!
https://coldbox-orm.ortusbooks.com/
8 stars 17 forks source link

Fix for Adobe 2016 Errors #30

Closed jclausen closed 5 years ago

jclausen commented 5 years ago

The Elvis operator has flaws in 2016 and will throw an error when the session is unmodified as the Elvis operator is returning null

The current implementation of these methods is not compatible with 2016

bdw429s commented 5 years ago

@jclausen Ugh, so annoying. Do you know if this is fixed in 2018? If not, we need to ensure there is a ticket. I can't reproduce this on 2016 with a similar code sample

https://trycf.com/gist/74adb9e98d5ee76e6f2bb74321758e37/acf2016?theme=monokai

On a side note, you need to update your code a bit. Please scope the variable you check with isNull() so it's local.modified. Otherwise isNull() will scope hunt and can find a url.modified or form.modified on accident. We've got to be explicit about the scopes with isNull to keep its blinders on.

jclausen commented 5 years ago

I'm not sure why the code sample above doesn't reproduce, but I'm not surprised. It probably has to do with something isModified returns.

The Elvis operator is really flaky on 2016 and I've stopped using it on that engine, because it returns inconsistent results. ORM functions seem to trigger the bug - like when the first argument is a relationship that is null. I suspect it has something to do with the metadata type of the null being returned or the fact that it's coming from native Java.

Good call on the local scoping. I'll make that change now.

I haven't had any issues with it on 2018, so it appears to be fixed in that release.

lmajano commented 5 years ago

I hate this! So inconsistent! ANyways, thanks so much @jclausen will add to patch release