Should we not assume that the dot and the square bracket are also denoted in CF as well?

With this code:

<cfset foo = {}> <cfset exists1 = !isDefined("foo.foo")> <cfset exists2 = isNull(foo.foo)> <cfset exists3 = isNull(foo['foo'])> 

Railo passes normally (all True), and CF throws an exception in the last line.

coldfusion.runtime.UndefinedElementException: The foo element is undefined in the CFML structure designated as part of the expression.

I always thought that the dot and square brackets in CFML should be functionally equivalent, in addition to the fact that the square brackets can define case-sensitive keys.

The error I reported here was recently marked "NotABug".

Can someone explain why?

+6
source share
1 answer

I added a comment to the error. Basically, the reason Adobe closed it as "no mistake" is because their engineer, who tricked him, is a muppet. He corrects the error.

And due to an error, your code does not work.

+5
source

Source: https://habr.com/ru/post/973809/


All Articles