ReplaceNoCase throws error with empty strings

I’ve recently found that replaceNoCase throws an error when it encounters an empty string, e.g:
ReplaceNoCase('test', '', 'test1');

Obviously, this isn’t a useful bit of code… nothing will be replaced, and it’s reasonable for the function to expect a string for the first and second parameters. However, in the case that you’re using a variable for the replace string, it may be that sometimes that var is empty and I’d expect the result to simply be the original string without replacements.

Importantly, this is the behaviour on ACF (and also on replace - the case-sensitive version), so it’s a gotcha when migrating to Lucee.

Tested in Lucee 5, 6 & 7 Beta, on trycf.

1 Like

This is an ACF compatibility issue. I have created a new ticket for this.
https://luceeserver.atlassian.net/browse/LDEV-5857

1 Like