Created attachment 182402 [details] The testing extension used in the forum.openoffice.org topic As discussed in https://forum.openoffice.org/en/forum/viewtopic.php?p=389232: Installing this extension, and using the simple spreadsheet function that it introduced, gives this unexpected result since v.5.4: =PYSTRINGTEST("abc")=PYSTRINGTEST("abc") gives FALSE. In previous versions, and in other OOo derivatives, it produces expected TRUE. The function is implemented to simply return its argument (see the linked forum thread).
The IDL-definition used in the extension looks wrong, IHMO it should be: ``` #include <com/sun/star/uno/XInterface.idl> module org { module pystrings { module pystringtest { interface XPyStringTest { string pystringtest( [in] string teststring); }; }; }; }; ```
(In reply to Werner Tietz from comment #1) IIUC, the function takes a 2D array, which is how ranges are passed to functions; so the function takes (and returns) a range (of strings). Having in A1:B3: a d b e c f putting in C1: =PYSTRINGTEST(A1:B3) (not as array formula) gives "a" in C1 (by intersection); if C1 contains =CONCAT(PYSTRINGTEST(A1:B3)) then C1 has "adbecf", because CONCAT takes the whole returned array. But in this case, putting this to C1: =PYSTRINGTEST(A1:B3)=PYSTRINGTEST(A1:B3) also returns the unexpected FALSE. So regardless of the intention (and correctness for author's purpose), the IDL seems OK-ish, and seems that it *should* work, with comparison of the array to the same-dimension same-content array looking also well-defined.
IHMO regardless of the intention, the function should work like any other formula taking a single argument by DEFAULT and evaluates also 2-dim-arrays OPTIONAL, that exactly works with the suggested change
(In reply to Werner Tietz from comment #3) Your suggested change does *not* "evaluate also 2-dim-arrays OPTIONAL", it only allows taking a scalar value (string) inside the function. If you imply that the function could be used inside an array formula, you declare that no add-in function may ever take arrays (and make that the API contract).
A short debugging revealed that the cause is the matrix/array elements' strings are svl::SharedString but apparently not interned, thus comparing the pointers of different instances yields false.
Eike Rathke committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/a56e5434a4ed453b55b8f060ed18404d77a9fb10 Resolves: tdf#150926 Add-In result svl::SharedString needs to be interned It will be available in 7.5.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.
Pending review https://gerrit.libreoffice.org/c/core/+/139841 for 7-4 https://gerrit.libreoffice.org/c/core/+/139842 for 7-3
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-3": https://git.libreoffice.org/core/commit/32da7faefc6568bf07f27eedaae5488fdf68cb65 Resolves: tdf#150926 Add-In result svl::SharedString needs to be interned It will be available in 7.3.7. 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.
Eike Rathke committed a patch related to this issue. It has been pushed to "libreoffice-7-4": https://git.libreoffice.org/core/commit/2919441c102122455b7b9967885a0a8a342eff56 Resolves: tdf#150926 Add-In result svl::SharedString needs to be interned It will be available in 7.4.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.