tracker issue : CF-4203313

select a category, or use search below
(searches all categories and all time range)

fileWrite() not equivalent to <cffile action="write"...> as does not support a "mode" parameter

| View in Tracker

Status/Resolution/Reason: To Fix//BugReVerified

Reporter/Name(from Bugbase): Tim Saunders / ()

Created: 09/03/2018

Components: File Management, CFFile

Versions: 11.0

Failure Type: Incorrect w/Workaround

Found In Build/Fixed In Build: 11,0,14,307976 /

Priority/Frequency: Normal / Some users will encounter

Locale/System: UK English / CentOS 7.2

Vote Count: 1

Problem Description:As far as I can tell I can't set the permissions of a file I create in cfscript without first creating the file and then using fileSetAccessMode()

Steps to Reproduce:
<!--- works fine --->
<cffile action="write" file="file" output="content" mode="664">

<!--- creates file with wrong access mode, fileWrite() does not support a mode parameter --->
    fileWrite( file, content, '664' );

Actual Result: fileWrite() creates files with incorrect access modes

Expected Result: fileWrite() should create files with the correct access mode

Any Workarounds: Use tag function, but cfscript shouldn't be 2nd class



Hi Tim, This is clearly a bug. Filewrite function supports only three parameters -> filepath, data, charset. However, there are lot of parameters supported by <cfile action='write'> tag such as mode, addnewline etc. Script syntax should have the support as well. We should provide support for all of them(including mode) in filewrite function. Moving it  to to->fix.
Comment by Poonam Jain
29689 | September 12, 2018 05:24:11 AM GMT