Unexpected behavior with param's required attribute

Description

The required attribute for cfscript version of <cfparam> defaults the variable to the value of the required attribute instead of requiring the variable to be present. However, omitting the required attribute does require the variable to be present.

<!--- raises missing required parameter error ---> <cfparam name="address1" required="true"> // raises missing required parameter error param name="address1"; // sets address1 to boolean of true if not present (should raise missing required parameter error) param name="address1" required=true; // sets address1 to string of yes if not present (should raise missing required parameter error) param name="address1" required="yes";

Environment

None

Activity

Igal Sapir 
7 July 2017 at 19:12

this should be re-opened

Igal Sapir 
7 July 2017 at 04:30
(edited)

changed attributes type to "fixed". "required" is not a known attribute.

Michael Offner 
12 June 2017 at 15:14

this is not about supported, Lucee should throw an exveption in that case

Pothys - MitrahSoft 
26 April 2017 at 05:19

Hi
I've compared the same in ACF but it throws error message.

Attribute validation error for tag CFPARAM. It does not allow the attribute(s) REQUIRED. The valid attribute(s) are DEFAULT,MAX,MAXLENGTH,MIN,NAME,PATTERN,TYPE.

Pothys - MitrahSoft 
25 April 2017 at 08:24

I've analysed this ticket lot & reproduced the issue. By using cfParam without assign default value in tag based it throws issue. But in script based it sets the boolean/String value which is defined in required. I've added testCases for this issue and created PR https://github.com/lucee/Lucee/pull/217.

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Sprint

Created 21 April 2017 at 16:38
Updated 1 August 2017 at 22:36
Resolved 7 July 2017 at 04:30