Created
June 20, 2025 01:26
-
-
Save trycf/76becc77bfd87c7a68c84a6cb2db4260 to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
test = "abc" & chr(0) & "xyz" & chr(0) & "123"; | |
writedump(test); | |
writedump( len(test) ); | |
writedump( find(chr(0), test) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong | |
writeoutput("<hr>"); | |
result = replace(test, chr(0), "", "all"); | |
writedump(result); | |
writedump( len(result) ); | |
writedump( find(chr(0), result) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong | |
writeoutput("<hr>"); | |
result = createObject("java", "java.lang.String").init(test); | |
result = result.replaceAll(chr(0), ""); | |
writedump(result); | |
writedump( len(result) ); | |
writedump( find(chr(0), result) ); // value=1 => NULL char is still there, and Lucee is tell you it is on position 1 which is wrong | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment