Vbscript Set myVar = Nothing only errors on localhost

282 views Asked by At

On a server running IIS6, vbscript/class asp code such as this works fine:

Set myVar = Nothing

I think it should error, as the variable is not Dim correctly and we are using <%Option Explicit%>. But it doesn't error.

However running exactly the same code on local IIS5.1 (with visual studio installed), throws an error (which it should).

I'm not too worried about the error itself (I think it should be erroring), but is there a reason why it would error on II5.1. rather than IIS6?

This still occurs when I turn off server-side/client-side debugging on the localhost.

1

There are 1 answers

1
AutomatedChaos On

OK, since you don't have an answer yet, I'll post my thinkings, maybe it'll lead to a solution.

In my framework (QTP), every module- or libraryfile that is attached to the main script needs to have the Option Explicit switch. When I forget her in only one of the scripts, the Option Explicit switch is ignored in all parts of the script.

Second, have you checked if myVar is not a public variable somewhere in your framework? You can test it by checking the vartype and the value/objecttype of the variable and/or replacing myVar by a variable name you are sure of it that doesn't exist.

And maybe someone tinkered with On Error Resume Next, but as I already said, I am not familiar with II6.