All work

 

Property Default Values Type Inconsistency

Description

Default values for component properties are inconsistently typed depending on whether they are defined as literals or as evaluated expressions.

When defining property default values in CFC components, the Lucee compiler currently handles the typing differently based on how the default value is provided:

  1. When using literals directly, the compiler converts all values to strings regardless of the specified property type:

  1. When using pound signs to evaluate the expressions, the values are correctly typed according to the property type:

Expected Behavior

Both approaches should result in the same behavior. The compiler should respect the specified property type (numeric, boolean, etc.) and cast the default values accordingly, regardless of whether they are provided as literals or as evaluated expressions.

Current Behavior

When using literals, all default values are treated as strings, ignoring the specified property type. When using evaluated expressions with pound signs, the values are correctly typed.

Steps to Reproduce

  1. Create a CFC with properties defined using both approaches

  2. Inspect the property values at runtime

  3. Observe that without pound signs (#), numeric and boolean properties have string values instead of their proper types

Related Issues

This issue was discovered while investigating another bug related to the import functionality.

Additional Notes

The compiler should handle both syntaxes consistently, treating default values according to their specified property types rather than converting literals to strings.

Environment

None

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

Sprint

Created 28 April 2025 at 18:46
Updated 28 April 2025 at 19:02

Activity