<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 - BASIC VBASupport=1 erroneously inherited by StrComp() in module without VBASupport"
   href="https://bugs.documentfoundation.org/show_bug.cgi?id=132347">132347</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>BASIC VBASupport=1 erroneously inherited by StrComp() in module without VBASupport
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>LibreOffice
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.4.3.2 release
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>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>jp@ledure.be
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Description:
When I run next Basic script:

Sub CompStr
Dim MyStr1, MyStr2, MyComp
MyStr1 = "ABCD": MyStr2 = "abcd"
MyComp = StrComp(MyStr1, MyStr2, 1)    ' Returns 0 (VBA) / -1 (no VBA)
MyComp = StrComp(MyStr1, MyStr2, 0)    ' Returns -1 (VBA) / 0 (no VBA)
MyComp = StrComp(MyStr2, MyStr1)    ' Returns 1.
End Sub

the behaviour of the StrComp() builtin function, with its "Compare" argument
set, is different depending on the presence/absence on the top of the module of

Option VBASupport 1

See the comments after each line above. This is already annoying but I don't
see how to correct this without breaking backward compatibility with many
scripts.

However, THE REAL NEW BUG IS HERE:

When I store above script in a module WITHOUT VBASupport set, and I call it
from another module like this:

Option VBASUpport 1
Sub Comp_Str_Call
        CompStr
End Sub

the CompStr routine bahaves as if the VBASupport in its module was set to 1,
which is not the case.



Steps to Reproduce:
1. Open TestStrComp.odt file
2. Open Basic IDE
3. 2 modules: NOVBA and VBA resp. with/without VBASupport
4. Step into (F8) the 3 proposed Subs
        CompStr_NOVBASUPPORT in module NOVBA
        CompStr_VBASUPPORT in module VBA
        CompStr_Call_NOVBASUPPORT
while watching the variable MyComp in the watch window

Actual Results:
When running CompStr_Call_NOVBASUPPORT() the called sub CompStr_NOVBASUPPORT()
computes the results of the StrComp() function as if Option VBASupport 1 was
present.

Expected Results:
The results of StrComp() should be computed without VBASupport


Reproducible: Always


User Profile Reset: No



Additional Info:
Version: 6.4.3.2
Build ID: 747b5d0ebf89f41c860ec2a39efd7cb15b54f2d8
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: kf5; 
Locale: fr-BE (en_US.UTF-8); UI-Language: en-US
Calc: threaded</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>