Major Flaw in CF9 – May Break Code!
As part of our upgrade to CF9, we started doing regression testing on our local boxes. My co-worker Joseph Lamoree found and blogged about a flaw he found in CF9 that brought our app to a halt. Serious, no joke.
Here is the issue in some detail. If you want to take a look at a MXUnit Test Case, then head over to Joseph’s blog on Posterous for more details as well.
I have two files, local.cfm and local.cfc.
Local.cfm has the following:
<![CDATA[
]]>
Local.cfc has the following:
<![CDATA[
]]>
When running this on CF8, I get the following output:
When running this on CF9, I get the following output:
First off, CF9 is killing firstName and lastName. It seems when
setting local to a Struct return from a function to start off, those
values are quickly killed.
Why is this a big issue? Well, in frameworks like Mach II, you can
start with:
<![CDATA[
]]>
What we see is that we have to do a structAppend, appending local to
the values we want from the function…
Seems to me that any cfset local = is being ignored more or less. That is why:
<![CDATA[
]]>
If you dump this, it behaves like the 2nd line never happened. It
shows the value for local.x. But this way, any function call to set
values to local also get ignored. I think if the programming ignored
the structNew(), but “appended” values from other functions instead of
ignoring, this would everyone happy.