Hello, Try these: 1) Print Mid("abc",4,2) returns "", no problem 2) Print Mid("abc",5,2) returns "!!br0ken!!" 2) seems to happen whenever second argument exceeds length of string plus 1. IMHO standard behaviour (some other languages *and* Apache OpenOffice) seems to be "if range fall outside string, return empty string" Raising a new incompatibility of code between AOO and LibO!!
I sent for review a patch (see https://gerrit.libreoffice.org/#/c/7539/) Noel: since I put you in cc of the gerrit, I thought you might be interested to be cced on the bugtracker.
BTW, here's the interesting of the bt: soffice.bin: /home/julien/compile-libreoffice/libo/sal/rtl/strtmpl.cxx:1269: void rtl_uString_newFromSubString(rtl_uString**, const rtl_uString*, sal_Int32, sal_Int32): Assertion `false' failed. Program received signal SIGABRT, Aborted. 0x00002aaaab28c1d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: Aucun fichier ou dossier de ce type. (gdb) bt #0 0x00002aaaab28c1d5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00002aaaab28f388 in __GI_abort () at abort.c:90 #2 0x00002aaaab285252 in __assert_fail_base (fmt=0x2aaaab3c3080 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x2aaaaad41a7a "false", file=file@entry=0x2aaaaad41a40 "/home/julien/compile-libreoffice/libo/sal/rtl/strtmpl.cxx", line=line@entry=1269, function=function@entry=0x2aaaaad42b20 <rtl_uString_newFromSubString::__PRETTY_FUNCTION__> "void rtl_uString_newFromSubString(rtl_uString**, const rtl_uString*, sal_Int32, sal_Int32)") at assert.c:92 #3 0x00002aaaab285302 in __GI___assert_fail (assertion=0x2aaaaad41a7a "false", file=0x2aaaaad41a40 "/home/julien/compile-libreoffice/libo/sal/rtl/strtmpl.cxx", line=1269, function=0x2aaaaad42b20 <rtl_uString_newFromSubString::__PRETTY_FUNCTION__> "void rtl_uString_newFromSubString(rtl_uString**, const rtl_uString*, sal_Int32, sal_Int32)") at assert.c:101 #4 0x00002aaaaad1b849 in rtl_uString_newFromSubString (ppThis=0x7fffffff3a08, pFrom=0x1dd81f0, beginIndex=4, count=-1) at /home/julien/compile-libreoffice/libo/sal/rtl/strtmpl.cxx:1269 #5 0x00002aaab321d4cf in rtl::OUString::copy (this=0x7fffffff3a80, beginIndex=4, count=-1) at /home/julien/compile-libreoffice/libo/include/rtl/ustring.hxx:1483 #6 0x00002aaab32fddf8 in SbRtl_Mid (pBasic=0x18d5bb0, rPar=..., bWrite=0 '\000') at /home/julien/compile-libreoffice/libo/basic/source/runtime/methods.cxx:1305
Julien Nabet committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=ff48f28f71609b0ab4e6b8bc79818f765e48fddd Resolves: fdo#73771 Non-standard behaviour for Function Mid The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-4-2": http://cgit.freedesktop.org/libreoffice/core/commit/?id=7713dfc9b50b88cf2548d49e65b099a6a81e9d65&h=libreoffice-4-2 Resolves: fdo#73771 Non-standard behaviour for Function Mid It will be available in LibreOffice 4.2.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
broken since 4.0.0 already; Julien fixed it
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-4-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=b703da40bb052809ff94a714fb8da7aadf2d7d6b&h=libreoffice-4-1 Resolves: fdo#73771 Non-standard behaviour for Function Mid It will be available in LibreOffice 4.1.6. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-4-2-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=de19819871a5ce1faabb9dced0e40df97d18e168&h=libreoffice-4-2-0 Resolves: fdo#73771 Non-standard behaviour for Function Mid It will be available already in LibreOffice 4.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Julien Nabet committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=4eda1a0293a869bf804056f1e9e04c984c69454d Add some unit-tests for Mid vb function (includes fdo#73771) The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Julien Nabet committed a patch related to this issue. It has been pushed to "libreoffice-4-1-5": http://cgit.freedesktop.org/libreoffice/core/commit/?id=04ad856f79de3f2987b8e23ce9d12c1cdaa73dd0&h=libreoffice-4-1-5 Resolves: fdo#73771 Non-standard behaviour for Function Mid It will be available already in LibreOffice 4.1.5. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.