Description: The 4-argument form of the BASIC instruction Mid(str,start,len,repl) is supposed to replace the selected sub-string with the specified replacement text. However starting with 6.1 it produces the wrong result if the replacement text is shorter than the selected text: the extra characters are not deleted. Note: The documentation says that the replacement text will be truncated if it is *longer* than the specified substring. However it is allowed to be shorter, in which case the extra character(s) should be deleted. Documentation is at https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Strings_(Runtime_Library) [search for "replaces three"] I will attach a spreadsheet with a small macro which demonstrates the bug. Steps to Reproduce: 1. Open attached "MidBugDemo.ods" spreadsheet 2. Enable macros & run the macro at <filename>->Standard->Module1->BugDemo (detailed instructions are in the spreadsheet) Actual Results: MyString = "This was my text" Mid(MyString, 6, 3, "is") RESULT IS "This iss my text" (wrong) Expected Results: Should get "This is my text" Reproducible: Always User Profile Reset: No Additional Info:
Created attachment 146517 [details] MidBugDemo.ods (see Steps To Reproduce)
The link to the documentation does not work because the final ")" is omitted from the URL inside the hyperlink. There must be a bug in the LO Bug system. Here is the url again in quotes. I'm hoping this works: 'https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide/Strings_(Runtime_Library)'
This seems to have begun at the below commit. Adding Cc: to Stephan Bergmann ; Could you possibly take a look at this one? Thanks 0de91826e0d5bceba5aa669cb0d8b266de5b325b is the first bad commit commit 0de91826e0d5bceba5aa669cb0d8b266de5b325b Author: Jenkins Build User <tdf@pollux.tdf> Date: Fri Apr 6 15:12:53 2018 +0200 source cc20344010e94eda22fee662aab966d395a0796a author Stephan Bergmann <sbergman@redhat.com> 2018-04-06 13:48:11 +0200 committer Stephan Bergmann <sbergman@redhat.com> 2018-04-06 14:56:20 +0200 commit cc20344010e94eda22fee662aab966d395a0796a (patch) tree 2653839238f1bdfac6c7f146a00b71f9210ce702 parent e66d7dbbfe83b5ca3e009540bdfbe42eb438e1b2 (diff) tdf#111313: Honor bWriteNoLenParam in !bCompatibility, too
Stephan Bergmann committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/+/a6a48eeef16e473be14642469cd922f177f54998%5E%21 tdf#121325: Replace all of given length, even if replacement is shorter It will be available in 6.2.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.
Verified in Version: 6.2.0.0.alpha1+ Build ID: db01b26d2e7d6626b7504fc7ee6ba6aac50e6098 CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US Calc: threaded @Stephan Bergmann, thanks for fixing this!!
(In reply to Commit Notification from comment #4) > Stephan Bergmann committed a patch related to this issue. > It has been pushed to "master": > > https://git.libreoffice.org/core/+/ > a6a48eeef16e473be14642469cd922f177f54998%5E%21 > > tdf#121325: Replace all of given length, even if replacement is shorter > > It will be available in 6.2.0. libreoffice-6-1 backport request is at <https://gerrit.libreoffice.org/#/c/63332/>
Verified. Thank you for the rapid fix! Version: 6.2.0.0.alpha1+ Build ID: 85dba18a3d3644a4ac49bd32ea106a4d69159fb4 CPU threads: 12; OS: Linux 4.15; UI render: default; VCL: gtk3; TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2018-11-13_23:14:30 Locale: en-US (en_US.UTF-8); UI-Language: en-US Calc: threaded
Stephan Bergmann committed a patch related to this issue. It has been pushed to "libreoffice-6-1": https://git.libreoffice.org/core/+/cb2cd5b76b0981bf07b8d1264f4b3074543a19eb%5E%21 tdf#121325: Replace all of given length, even if replacement is shorter It will be available in 6.1.4. 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.
*** Bug 121920 has been marked as a duplicate of this bug. ***
*** Bug 122352 has been marked as a duplicate of this bug. ***