[Libreoffice-bugs] [Bug 125180] New: Bad behaviour in BASIC procedure with several optional parameters.

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Wed May 8 22:01:11 UTC 2019


https://bugs.documentfoundation.org/show_bug.cgi?id=125180

            Bug ID: 125180
           Summary: Bad behaviour in BASIC procedure with several optional
                    parameters.
           Product: LibreOffice
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs at lists.freedesktop.org
          Reporter: luismiguel.lacosta at gmail.com

Description:
In a BASIC procedure with two optional parameters when you call the procedure
with the first parameter omited and the second parameter present then the fist
parameter receives a value and the function IsMissing returs false.

I attached a test file with this BASIC code:

option explicit

Sub Main
        SubOneParameter()
        SubOneParameter(1)
        SubTwoParameters()
        SubTwoParameters(,)
        SubTwoParameters(,2)
        SubTwoParameters(1,)
        SubTwoParameters(1,2)   
End Sub

sub SubOneParameter(optional lPar1 as integer)
        if ismissing(lPar1) then
                msgbox("Missing parameter")
        else 
                msgbox("Not missing parameter, value "+lPar1)
        endif           
end sub

sub SubTwoParameters(optional lPar1 as integer,optional lPar2 as integer)
dim cMsg as string
        if ismissing(lPar1) then
                cMsg="Missing first parameter"
        else 
                cMsg="Not missing first parameter, value "+lPar1
        endif
        cMsg=cMsg+chr(13)
        if ismissing(lPar2) then
                cMsg=cMsg+"Missing second parameter"
        else 
                cMsg=cMsg+"Not missing second parameter, value "+lPar2
        endif
        msgbox(cMsg)
end sub

Actual Results:
In The call SubTwoParameters(,) the first parameter (not present) receives the
value 448 ??? and shows message
Not missing first parameter, value 448
Missing second parameter

In The call SubTwoParameters(,2) the first parameter (not present) receives the
value 448 ??? and shows message
Not missing first parameter, value 448
Not missing second parameter, value 2

Expected Results:
When the first parameter is not present never must reveive a value.


Reproducible: Always


User Profile Reset: Yes



Additional Info:

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice-bugs/attachments/20190508/d91efdf5/attachment.html>


More information about the Libreoffice-bugs mailing list