<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - Bad behaviour in BASIC procedure with several optional parameters."
href="https://bugs.documentfoundation.org/show_bug.cgi?id=125180">125180</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Bad behaviour in BASIC procedure with several optional parameters.
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86-64 (AMD64)
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows (All)
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>BASIC
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>luismiguel.lacosta@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>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:</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>