Tuesday 2 April 2013

ColdFusion bugs I'd like to see dealt with: param (first in what will be a series)

G'day:
With the upcoming ColdFusion 11 pre-release, I'm going to start banging about some ColdFusion bugs that piss me off. I'll mention them as I encounter them in my day-to-day work.

First up: param. There's a bug with param detailed in bug 3364510. Basically it's not been completed.


The gist of it is demonstrated with a coupla quick bits of code:

<cfparam name="URL.notOptional">
Should not see this

If you save that to a file and just run it (without passing the URL param), you'll get an exception, as one would expect:

The required parameter URL.NOTOPTIONAL was not provided.

This page uses the cfparam tag to declare the parameter URL.NOTOPTIONAL as required for this template. The parameter is not available. Ensure that you have passed or initialized the parameter correctly. To set a default value for the parameter, use the default attribute of the cfparam tag.
The error occurred inC:/apps/adobe/ColdFusion/10/cfusion/wwwroot/shared/junk/crap.cfm: line 1
1 : <cfparam name="URL.notOptional">
2 : Should not see this

This is correct behaviour.

And using the CFScript equivalent:

<cfscript>
    param name="URL.notOptional";
    writeOutput("Should not see this");
</cfscript>

We get this:

Should not see this


So param has not been implemented correctly.

This was something I noticed quite recently - November last year - so I have no expectation for it to have been dealt with yet, but I'd like it sorted out in ColdFusion 11. So far no-one at Adobe have even looked at it, which is slightly slack. These things should get triaged as they come in, so as to indicate to the person raising it that the bug tracker is not a black hole. I know it's not a black hole, but other people might be left slightly let down by Adobe's current approach to triaging bugs.

There's a tangential bug I've raised as 3434535. Running this code:

<cfscript>
param name="URL.requiredParam";

writeDump(var=URL, label="URL");
writeDump(var=variables, label="variables");
</cfscript>

Yields this output:

URL - struct [empty]
variables - struct
NAMEURL.requiredParam

I suspect this is a symptom of what's wrong with the implementation of param. That variables.name should not be getting created.

Obviously the same doesn't happen using <cfparam>, because the code errors right away (like it's supposed to).

I'm pleased to say that neither Railo nor OpenBD suffer from these glitches.

These ones are not very interesting, but irritate me. And it's probably something for you to keep your eye out for.

Righto.

--
Adam