Description: The return value of Basic function is not initialized when called by the invoke method Steps to Reproduce: Insert the next script into module Module1 of library Standard of any Calc document. Option Explicit Function ConcatArray(arr) As String Dim v For Each v In arr ConcatArray=ConcatArray & v Next v End Function Sub Test1 Msgbox ConcatArray(Array("a", "b")) Msgbox ConcatArray(Array("c", "d")) End Sub Sub Test2 Dim script script = ThisComponent.scriptProvider.getScript("vnd.sun.star.script:Standard.Module1.ConcatArray?language=Basic&location=document") Msgbox script.invoke(Array(Array("a", "b")), Array(), Array()) Msgbox script.invoke(Array(Array("c", "d")), Array(), Array()) End Sub Actual Results: Run "Test1". It shows ab cd Then run "Test2". It shows cdab cdabcd Expected Results: Test2 MUST show ab cd Reproducible: Always User Profile Reset: No Additional Info:
Repro. XScript::invoke [1] is documented to return "the value returned from the function being invoked". It doesn't mention "... and keep a copy to attach to the next return as a bonus" ;-D [1] https://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1script_1_1provider_1_1XScript.html#a11a551f5a2520f74c5109cd8c9f8c7b7
Repro in: Version: 6.2.5.2 (x64) Build-ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159 CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; VCL: win; Gebietsschema: de-DE (de_DE); UI-Sprache: de-DE Calc: threaded
Andreas Heinisch committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/24d24debef4cda7de702c4b470a3707f1aae3ea3 tdf#143582 - Clear return value of the method before calling it It will be available in 7.3.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Thank you, Andreas!
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-2": https://git.libreoffice.org/core/commit/cb97358ab845f13f1c57b410e59126f20652d552 tdf#143582 - Clear return value of the method before calling it It will be available in 7.2.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Andreas Heinisch committed a patch related to this issue. It has been pushed to "libreoffice-7-1": https://git.libreoffice.org/core/commit/c2697c468c1441df61b2d590a7cb259d21b3ba60 tdf#143582 - Clear return value of the method before calling it It will be available in 7.1.6. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/822998f1dc202aba7a558767f641687aef0c1148 tdf#143582: Avoid error on clearing leftover return value of a method It will be available in 7.4.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Mike Kaganski committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/29ec800034211194f9e2ab1748e0b6a1011dcf3f tdf#143582: Avoid error on clearing leftover return value of a method It will be available in 7.3.0.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.