PRB: No Error when Non-Array is Passed to Sub That Requires One

Last reviewed: November 26, 1997
Article ID: Q177379
The information in this article applies to:
  • Microsoft Internet Explorer (Programming), versions 3.01, 3.02, 4.0 on the following platforms: NT, Win95
  • Microsoft Internet Information Server versions 2.0, 3.0, 4.0

SYMPTOMS

In VBScript, when a function that is expecting an array as an argument is passed an argument that is not an array, but the function does not do any array-specific processing, no error is displayed and the function works normally.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

The following code will not produce an error saying that an array was expected, on the statement "ArrayFunction 3."

   <HTML>
   <HEAD>
   <TITLE> Page1 </TITLE>
   </HEAD>

   <BODY>

   <SCRIPT LANGUAGE="VBScript">

   call main

   sub ArrayFunction(a())
       document.writeln("text")
   end sub

   sub main()
       ArrayFunction array(1,2)
       ArrayFunction 3  ' this would cause an error in VBA
   end sub

   </SCRIPT>

   </BODY>

   </HTML>


In VBScript, this just runs, with no error. In Visual Basic for Applications, however, you get a compile error on the line "ArrayFunction 3" saying an array was expected.


Additional query words: Error missing lacking array function
Keywords : vbsMisc
Technology : kbInetDev
Version : WINDOWS:3.01,3.02,4.0; WINNT:2.0,3.0,4.0
Platform : WINDOWS winnt
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 26, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.