BigDecimal cfswitch unexpected behaviour

Not sure if anything can or should be done about this but probably worth discussing.

Using a DB query, we have a variable with the value 2.00 and the type BigDecimal.

If we compare with 2, 2.0, “2” or “2.0” using eq, Lucee says the two are equal.

If we switch in cfscript with a case of 2, Lucee matches the case value.

However, if we use the cfswitch tag, Lucee does not match the case 2 for certain versions. Specifically, version 5.2.9.31 does match the case, but version 5.3.10.120 does not.

I think the cause is this commit: LDEV-4103 - handle BigDecimal whn converting to string · lucee/Lucee@ec467ba · GitHub

The reason being is that I think for the cfswitch tag, the value is first cast to a string “2.00” which is not equal to the string “2”.

Just because it “used to work” doesn’t mean it should be changed to work now. If values are being cast to string, then I’m not sure this should be fixed.

Thoughts? Ideas?

Original post and more info: CFSwitch change after p740 / Lucee 5.3 upgrade - support - FarCry Dev Forum

that’s regression, so please file a new ticket and link it to the commit from that task