Sometimes I still SMDH on ColdFusion2021 code inco...
# cfml-general
c
Sometimes I still SMDH on ColdFusion2021 code inconsistency and how they treat cfscript. According to docs, FileAppend default addNewLine is supposed to be No. Adds a New line counter to docs FileAppend(file = "D:\settings\foo.txt",data = "bar"); Throws an empty string error, FileAppend(file = "D:\settings\foo.txt", data = "bar", addNewLine="no"); FileAppend(file = "D:\settings\foo.txt", data = "bar", addNewLine="yes"); //Works as expected but you have to supply both optional parameters which is a bit counter intuitive FileAppend(file = "D:\settings\foo.txt", data = "bar", charset="UTF-8",addNewLine="no"); FileAppend(file = "D:\settings\foo.txt", data = "bar", charset="UTF-8",addNewLine="yes");
j
If I am reading the documentation correctly, it looks like you're looking at the
Required
column in the table and interpreting it as
Default
. https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-e-g/fileappend.html CFDocs.org indicates the default is
true
. https://cfdocs.org/fileappend
As to the empty string error when you don't have both arguments passed, that's silly.
c
yeah, missed that. just me I guess, I think in other documentation it usually specifies required and the default value, which this page did not. You're right it's silly on the arguments requiring both just to turn off add new line. Programmers not thinking outside the box and handling all the permutations.
j
cfdocs.org has an additional note in there about CF 2016 and CF 2018 prior to a specific update requiring the
charset
argument. There's nothing in there about CF 2021, but it sounds like their may be an undocumented occurrence with that in CF 21 also. 🤷‍♂️