query reports wrong queryparam name was empty

Description

p = { "iids" : {type: 'integer', value: [] }, // change to ids, ok id: {type="integer", value="1"} }; q = queryNew("id","numeric"); r="error"; sql = "select id from q where id= :id"; try { r = queryExecute(sql: sql, params=p, options={dbtype:"query"} ); } catch(e){ dump(e); } dump(r);

throws param [id] may not be empty

expected: `iids` is not referenced so it shouldn’t even be evaluated and that shouldn’t throw

 

lucee.runtime.exp.ApplicationException: param [id] may not be empty at lucee.runtime.tag.util.QueryParamConverter.get(QueryParamConverter.java:234) at lucee.runtime.tag.util.QueryParamConverter.convert(QueryParamConverter.java:189) at lucee.runtime.tag.util.QueryParamConverter.convert(QueryParamConverter.java:73)

https://trycf.com/gist/3b8a5c16a8b5f0d2359da3ee3649aad2/lucee5?theme=monokai

this manifests with QoQ a bit differently too, triggering a fallback to HSQLDB

https://trycf.com/gist/b510edfe44d1be8baf452dd499008f11/lucee5?theme=monokai

Environment

None

Activity

Show:

Zac Spitzer 22 July 2022 at 15:00

Zac Spitzer 17 February 2022 at 21:01

the problem is it was checking if every param was empty, while it only should check if the name matches

https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/tag/util/QueryParamConverter.java#L237

https://github.com/lucee/Lucee/pull/1573

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 17 February 2022 at 12:40
Updated 3 June 2024 at 08:38

Flag notifications