can't cast empty string to a number value with cf_sql_decimal and null=true

Description

cfqueryparam null=true does not ignore the value attribute for cfsqltype="cf_sql_decimal".

The code below will result in the following error:

lucee.runtime.exp.CasterException: can't cast empty string to a number value at lucee.runtime.op.Caster.toDoubleValue(Caster.java:448) at lucee.runtime.op.Caster.toDoubleValue(Caster.java:396) at lucee.runtime.op.Caster.toDecimal(Caster.java:827) at lucee.runtime.tag.QueryParam.check(QueryParam.java:236) at lucee.runtime.tag.QueryParam.doStartTag(QueryParam.java:214)

 

This code works in ACF, and it actually works for other sql types in Lucee, but it does not work for cf_sql_decimal. This code should insert a NULL and ignore the fact that the value is not a number. A workaround for this is to use cf_sql_numeric vs. cf_sql_decimal, but I am not sure what implications that may have.

 

Here is an old Railo ticket that is similar to this issue:

https://issues.redhat.com/browse/RAILO-494?page=com.atlassian.jirafisheyeplugin%3Afisheye-issuepanel

Environment

None

Activity

Show:
Pothys - MitrahSoft
October 27, 2020, 10:55 AM
Edited

I've checked this ticket and confirmed the issue happened on lucee latest version 5.3.8.90-SNAPSHOT also. While using null value with cfsqltype = cf_sql_decimal with null=true throws an exception "can't cast empty string to a number value". But in ACF works fine with a null value.

Pull Request: https://github.com/lucee/Lucee/pull/1094

Assignee

Michael Offner

Reporter

Brian Quackenbush

Priority

New

Labels

Fix versions

None

Affects versions

Configure