Sunday, 22 February 2015

ColdFusion: testing the recent updates

G'day:
As I'd raised a few of the issues Adobe claims to have fixed in these recent ColdFusion updaters, I figure I should probably do some testing for them.

First up, ColdFusion 11 update 5


Error in AdminAPI (3845479)

This was just some bad validation in the Admin API. Repro:

// 3845479.cfm
new CFIDE.adminapi.administrator().login("");

writeOutput(new CFIDE.adminapi.Security().isAdminUser());

This was yielding an error:

Variable SECURITY is undefined.

The error occurred in base.cfc: line 27
-1 : Unable to display error's location in a CFML template.

With the offending line being the isAdminUser() call.

On the update 5 pre release this now works fine, yielding true.

1/1 fixed.

Unhandled error in CFAdmin (3845476)

I wrote a whole blog article around this one (indeed, the other one was found during writing of the same article): "ColdFusion bug challenge: how quickly can one find a bug in ColdFusion 11?". Basically there's some bad error trapping in CFAdmin, should one try to set-up new CFAdmin users before setting the " Separate user name and password authentication" setting. The full repro is in that blog article: I'll not repeat it here.

Firstly I verified the issue still existed in ColdFusion 11 update 4: yes.

Now I'm trying to repro on update 5...

... and indeed I an no longer reproduce it. Fixed.

2/2 fixed.

WSConfig does not back up all the config files it changes (3358792)

This was a bloody annoying one. If one had made modifications to the web server connector config files, they weren't backed-up if one had to reinstall the connector (which, let's face it, is almost every time there's an update it seems). Not only did it not back-up the changed files, it also wiped any of one's own back-ups one might have made because the process blows away the entire directory.

I'm not prepared to do the requisite messing around to test this, so I'll leave this as an unknown.

listFilter() doesn't correctly handle multi-char delimiters (3750733)

Excellent! An actual language issue. I covered this one in a blog article too: "Bugs in iterator functions in both Railo and ColdFusion".

Here the ColdFusion Team (and, to be fair, the Railo Team had made the same mistake), had messed up how to delimit a filtered list. They were using the entire delimiters argument value, forgetting it could be a multi-delimiter value. Here's the repro:

// 3750733.cfm
original = "11,23;31:43^53-61";
delims = ",;:^-";

filtered = listFilter(original,function(v){
return reFind("3$", v);
},delims);

writeDump([original,filtered]);

On ColdFusion update 4 this returns:

array
111,23;31:43^53-61
223,;:^-43,;:^-53

Obviously the intended result is "23,43,53". In discussions over this ticket, Rupesh suggested they'd just use the first delimiter character in the result list, as this matches listSort()'s behaviour. Fair enough.

And running this on update 5 gives:

array
111,23;31:43^53-61
223,43,53

Good work ColdFusion Team: 3/3 fixed.

Mixed-in functions cannot access SUPER "scope" on first hit to a function (3774074)

This one was some weirdness we encountered with - well, as it says above - mixed-in methods accessing the super scope. I write it up in this article: "Super and mix-ins don't mix very well". The full repro involves a bunch of files, so just refer back to that article.

Checking this again on update 4 I get...

The basePrivateMethod method was not found.


Which is what we'd expect. On update 5, however, it works fine.

Score: 4/4 fixed.

each() does not support ordered arguments (3791747)

This one was a glitch in that the .each() method for the arguments scope didn't seem aware that arguments can be passed both as name value pairs, or as simply ordered values: it did not preserve the argument order if ordered arguments were used. Repro:

// 3791747.cfm
iterateArgs = function(){
    arguments.each(function(){
        writeDump(var=arguments);
    });
};

iterateArgs("tahi", "rua", "toru", "wha");

On update 4 this might output:

struct
12
2rua
struct
11
2tahi
struct
13
2toru
struct
14
2wha

Note how the arguments are not in order here. On update 5 we get this:

struct
11
2tahi
struct
12
2rua
struct
13
2toru
struct
14
2wha

Perfect.

And a perfect score for the ColdFusion Team so far: 5/5 bugs fixed.

arrayFilter() / .filter() callback needs to be passed element, index and array (3810965)

The callbacks for these methods need to be analogous to the other array iteration methods: not simply receiving the element value, but also receiving the index and a reference to the whole array.

Here's a repro:

// 3810965.cfm
numbers = ["tahi", "rua", "toru", "wha"];
numbers.filter(function(){
    writeDump(arguments);
    return true;
});

On ColdFusion 11 update 4 I get this:

struct
1tahi
struct
1rua
struct
1toru
struct
1wha

On update 5 it's correct:

struct
1tahi
21
3
array
1tahi
2rua
3toru
4wha
struct
1rua
22
3
array
1tahi
2rua
3toru
4wha
struct
1toru
23
3
array
1tahi
2rua
3toru
4wha
struct
1wha
24
3
array
1tahi
2rua
3toru
4wha

Nice one.

6/6 bugs fixed in update 5 ColdFusion Team: good work.

I've just noticed I didn't actually raise any of the tickets fixed in the ColdFusion 10 update 16 pre-release, so there's nothing for me to check there. If you did raise any of the issues that got fixed, make sure to test 'em eh?

Good work Adobe ColdFusion Team on these. There's another coupla ones I'm gonna look at separately as they sound interesting, but I'm pleased at your 100% strike rate on these issues I raised. Keep it up.

--
Adam