bracket notation creates new variable as struct instead of array

Description

Update: simplified repro case:

myVariable[1] = '' isArray( myVariable ) // false isStruct( myVariable ) // true

--------------------------------------------------------------------------------------------------------------

Ran this code on cflive.net and when i run this code:

<!-- put your content here --> <cfset bk[1]["Qty"] = ""> <cfdump var="#variables#" abort> <cfset sb = IIF((isDefined('bk[1]["Qty"]') AND bk[1]["Qty"] NEQ ""),"'#bk[1]["Qty"]#'","'NULL'")> <cfdump var="#sb#">

and noted the versions on the cflive.net lucee running: 2016,0,03,300357
and ACF running 2016,0,03,300466

uploaded this image: the above code shows dump in lucee as:

uploaded this image: and coldfusion error out as:

Attachments

2
  • 15 May 2017, 04:49 pm
  • 15 May 2017, 04:49 pm

Activity

Show:

Michael Offner 12 June 2017 at 15:25

completely right, it will be an incompatibility, can you please add this ticket to the incompatibility list

Gurpreet Randhawa 20 May 2017 at 06:20

If this has to be decided between couple of developers, then there is no reason to explain me the scenario, i raised a bug the way i ran the code and i presume that if it does not work in ACF, it should not work in Lucee, because it is said to be an alternative as even lucee does not provide all functionality ACF is providing,

Do whatever you want to do with this BUG, I raised it, because i found it, if you fix it, its Good and If not, Its good, I will always see this as Incompatible.

PS: Please don't explain me now.

Thanks

Adam Cameron 19 May 2017 at 07:32
Edited

: after 's demonstration, I believe Lucee is doing the right thing. And you know what I'm like about variation from CF, but I don't think Lucee should change behaviour here just for the sake of it. IE: it's fine as-is. Maybe just document it.

At the end of the day 's code isn't ideal, and he's suffering the consequences of it. Just don't write subpar code then there is no problem.

the problem here really is your code, not Lucee. There's no need for a setting to toggle this behaviour.

The action points are twofold, IMO:

  • at some stage Lucee should document this different. Low priority IMO. We've got this Jira ticket here already which discusses it and ppl can be pointed to it if the situation crops up again;

  • to improve their code so they don't fall loul of this.

Michael Offner 19 May 2017 at 07:25

Is the ACF or the Lucee behaviour better? I'm not sure.
I think it is important to document this, but have in mind that this difference exist for 10 years and now was the first time reported. So not really a road blocker for most users.

Michael Offner 19 May 2017 at 07:23

problem with a setting in the application.cfc is.
If someone encounters this, the chance that they are aware of that setting or thinks, i should check the doc if there is a way around is, next to zero. So would a setting like this help people if the default behavior is like it is today. I personally don't think so.

Details

Assignee

Reporter

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

Affects versions

Priority

Created 15 May 2017 at 02:47
Updated 26 May 2021 at 13:03

Flag notifications