Apache OpenOffice (AOO) Bugzilla – Issue 11678
Bug with using Optional Parameters and IsMissing in Basic Macros
Last modified: 2003-03-12 14:33:05 UTC
When using the Subroutine/function below, I get results that I should not get it looks like there is some sort of bug concerning the usage of Optional values in calling Subs/Functions when I declare the type of the Optional value (Only tested String and Long, but I guess it is the same for the others) Here is my test code, a better description follows below. Sub test() MsgBox "a-" & testMissing() MsgBox "b-" & testMissing(1) MsgBox "c-" & testMissing(1,2) MsgBox "d-" & testMissing(1,2,3) MsgBox "e-" & testMissing(1,,) MsgBox "f-" & testMissing(1,2,) MsgBox "g-" & testMissing(1,,3) MsgBox "h-" & testMissing(,2,) MsgBox "i-" & testMissing(,2,3) MsgBox "j-" & testMissing(,,3) MsgBox "k-" & testMissing(,,) End Sub Function testMissing(Optional s1 as Long, Optional s2 as Long, Optional s3 as Long) Dim sTest As String If( IsMissing(s1)) Then sTest = "[<MISSING>]" Else sTest = "[" & s1 & "]" End If If( IsMissing(s2)) Then sTest = sTest & "[<MISSING>]" Else sTest = sTest & "[" & s2 & "]" End If If( IsMissing(s3)) Then sTest = sTest & "[<MISSING>]" Else sTest = sTest & "[" & s3 & "]" End If testMissing = sTest End Function what I believed I would get is the following a-[<MISSING>][<MISSING>][<MISSING>] b-[1][<MISSING>][<MISSING>] c-[1][2][<MISSING>] d-[1][2][3] e-[1][<MISSING>][<MISSING>] f-[1][2][<MISSING>] g-[1][<MISSING>][3] h-[<MISSING>][2][<MISSING>] i-[<MISSING>][2][3] j-[<MISSING>][<MISSING>][3] k-[<MISSING>][<MISSING>][<MISSING>] and to begin with it worked, the a,b,c,d,f worked as I had expected it, but the rest, they produced something strange.. e-[1][448][<MISSING>] g-[1][448][3] h-[448][2][<MISSING>] i-[448][2][3] j-[448][448][3] k-[448][448][<MISSING>] I have also tried this with Strings instead of Long as parameter type, but then I did not get the 448 but I did get a string looking like this "Error " with a square character at the end. when removing the as Long/String in the function declaration Function testMissing(Optional s1, Optional s2, Optional s3) Everything works as expected. considering that when I do not send in any parameter at all compared to when I send in "empty MsgBox "a-" & testMissing() MsgBox "k-" & testMissing(,,) these should perform the same for me, and I do get "Missing" in the first case, so it is possible that a Long/String can be missing
Misfiled, the framewwork/ scripting deals with the langauge independent scripting framework, not Star Basic: This StarBasic issue should be filed under: Component: Scripting SubComponent: Code
Status changed to INVALID - refer to comment below on mis-filing
As mentioned on the qa dev list on March 5th I will close all resolved <wontfix/duplicate/worksforme/invalid> issues. Please see this posting for details. First step in IssueZilla is unfortunately to set them to verified.
As mentioned on the qa dev list on March 5th I will close all resolved <wontfix/duplicate/worksforme/invalid> issues. Please see this posting for details.