Replace and ReplaceNoCase Struct Replace All not working

Description

Run the following code on 5.3.4.73-RC or later and up to the latest snapshot, 5.3.5.55-SNAPSHOT:

<cfscript> theString = 'this-is-my-string'; theNewString = ReplaceNoCase( theString, { "this-is-my-string" = 'this-is-my-new-string', "this-is-my-other-string" = 'this-is-my-new-string' } ); dump(theString); dump(theNewString); </cfscript>

and you will see that the string is replaced with invalid characters, as shown here:

I have noticed this is, however, not consistent and sometimes works ok, but if refresh several times you will see that more often than not, it does what is described above.

Also, you must have more than one key/value pair in the structure for this to occur.

I have tested on both a Lucee install on Tomcat 9 with Java 11 and a CommandBox install with Java 1.8, and both have the same result.

The latest Lucee release, 5.3.3.62 as well as previous releases, 5.3.2.77, 5.3.1.102, 5.3.1.95 and 5.2.9.31 do not have the issue.

Environment

None

Attachments

1
  • 02 Jan 2020, 04:35 pm

Activity

Show:

Andrew Dixon 17 February 2020 at 10:44

The replace() function also has the same bug.

Pothys - MitrahSoft 3 January 2020 at 07:51

I've checked and added a test case for this ticket and confirm the issue has been replicated in 5.3.3.62 onwards to the latest version 5.3.5.55 SNAPSHOT also.

Pull Request: https://github.com/lucee/Lucee/pull/821

Fixed

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Created 2 January 2020 at 16:40
Updated 24 November 2021 at 12:14
Resolved 3 August 2020 at 11:15

Flag notifications