How can you disable the sameformfieldsasarray when you have an Application.cfm file?
I'm porting a legacy application from ColdFusion 9 to ColdFusion 10. The site uses an old school Application.cfm file.
I see that 10 added a new setting (this.sameformfieldsasarray) that you can enable that will combine form variables into an array when there is more than one of them. This is supposed to be off by default, but unfortunately it's "on" for the fresh installation I just set up.
I can't set this.sameformfieldsasarray false because we've got Application.cfm instead of Application.cfc, and I can't find anything in the admin or documentation.
The code is run from a fresh install of CF10 on Ubuntu 12.04 x64. #Adam verified that the sample code worked on Windows Server 2003 x64.
Code: https://gist.github.com/2931343
Screenshot of sample submit: http://imgur.com/Q9DAi
Screenshot of server scope: http://imgur.com/9iwWL
Bug report submitted: https://bugbase.adobe.com/index.cfm?event=bug&id=3214734
I'm not sure about this one. CF 10 is so new that you are probably the first person to ask this question in public (ha). But perhaps you could do the following in your application.cfm.
<cfloop collection="#form#" item="fitem">
<cfif isArray(form[fitem])>
<cfset form[fitem] = arraytolist(form[fitem])/>
</cfif>
</cfloop>
That would set things right I suspect.
This issue is now resolved in
ColdFusion 10 Update 1 which was released on 31st August 2012.
Applying the update should resolve the issue and allow workarounds such as the one suggested by Mark A Kruger to be removed.
Related
I am trying to install ColdFusion 5 but it looks like data2.cab file is missing from my copy. I understand on Adam Cameron's Dev Blog he had a copy of Coldfusion 5 from the document he wrote about installing it on Windows 7 64bit. Does anyone have a copy of the software please?
You can find installers for older versions of ColdFusion on a community maintained site: http://www.cfmlrepo.com/
I doubt you'll be able to get it up and running reliably as it's a 32-bit installer and won't run on modern Windows. It's pre-Java, so you'll also have issues with C compatibility for things like custom CFX tags. If you've got an old OS on a server somewhere, maybe you can do something with it.
What problem are you trying to address? Working on a legacy application? CF 5 should no longer be running any kind of production sites as there are a world of security issues given the modern Internet.
If possible, I'd suggest trying to run the code on the open source Lucee CFML engine https://www.lucee.org/. Depending on the complexity of your application, it won't just be a matter of setting up data sources and running the code. But in the long run, if this app needs to exist for a while more, it'll be a safer and less expensive solution.
If you have more questions about CF 5, you'll probably find more help on the CFML Slack channel. You can get an invite here: https://cfml-slack.herokuapp.com/
This is odd and undoubtedly just another case of my embarrassingly limited capacity for problem solving causing issues BUT - We have an API that we've been using since October of 2012. Changes are VERY few and far between (as in maybe, two or three tweaks total).
About 3 months ago is APPEARS as though this.datasource in application.cfc stopped being recognized. The server was reporting this.datasource = ''.
Does anyone have any experience with this or insight into the circumstances under which this could happen? I'm more than happy to wear the dunce hat on this one but it has nme a bit emotionally bedraggled and I just 'gotta know'...my ninja theory isn't getting much traction in the office.
I've had similar issues before. To fix it I moved <cfset this.datasource = "whatever" /> to the OnApplicationStart function in application.cfc.
After you do so, remember to reinit the application.
Strictly speaking, the this scope in Application.cfc refers to fields that are specific to the application file itself. For example, sessionTimeout, applicationTimeout, loginStorage and so on. You may loosely interpret them as the application's meta data. Fields defined with this are therefore not meant to be accessed elsewhere in the application.
Datasource is the kind of property that refers to the application. You should therefore define it in onApplicationStart as:
application.datasource
I'm working on upgrading an app from MX7 to 9 and testing it on my Mac's Dev server. I have a page with a large cfswitch--20 or so different cases, but none more than about 10-12 lines long. In CF9 only, whenever one of these cases does a cfinclude (which is almost all of them), I get an error along the lines of:
org.apache.bcel.generic.ClassGenException: Invalid branch target position offset for jsr[168](3):-1: -1: astore[58](2) 27 at
cfindex2ecfm581352809._factor4(/Users/dlaughland/Workspace/abcapp/surveymanager /surveys/survey/index.cfm:34) at
cfindex2ecfm581352809._factor28(/Users/dlaughland/Workspace/abcapp/surveymanager/surveys/survey/index.cfm:33) at
cfindex2ecfm581352809.runPage(/Users/dlaughland/Workspace/abcapp/surveymanager/surveys/survey/index.cfm:1) at
cfApplication2ecfc1705547767$funcONREQUEST.runFunction(/Users/dlaughland/Worksp ace/abcapp/Application.cfc:215)
I have googled extensively, and the best explanation I can find is a JDK error that was supposedly fixed in MX7! What is causing this? How do I fix it? This isn't the only page with a large cfswitch so I really don't want to re-write everything into cfif structures.
You can file a bug, but here are some steps that might help you work around the issue.
Try updating your JRE version, you can get the latest and greatest here. You can then ask CF to use that JRE via your CF Admin > Server Settings > Java and JVM. Further instructions here.
Try using a servlet container, for example use Tomcat instead of the bundled JRun. Here are some instructions.
Can I ask if you are going to use this in production on a Mac? If not, try running your code on a OS that will mirror your live site. The bug (if it is a bug) may not be in that version of CF.
Hope something there helps.
If you upgraded from CF7 to CF9 with the code already on the server, try deleting all of the classes from WEB-INF/cfclasses and restarting CF.
I have a Windows 2000 server running ColdFusion 5.0 and one rather large legacy application. The original developer has long since come and gone.
The server needs to be retired, and none of the ColdFusion media can be found. The course of action will be too purchase ColdFusion 8 and use that (Unless anyone has a suggestion on an alternative).
Can anybody comment as to how much backwards incompatibility exists between ColdFusion 5.0 and 8.0? Will I be able to just copy and run the website or will I need to trawl through the code changing syntax or references?
Within the ColdFusion Administrator is a Code Analyzer for help with situations like this.
Download the (Free) ColdFusion 8 Developer Edition
Open up the Administrator and go to Debugging & Logging > Code Analyzer
Run your code through that and it should identify any problems.
I'm not exactly sure on the amount of backwards compatibility, but you should download the developer edition and give it a test run plus its free since its only for development.
ColdFusion Developer
You shouldn't have any problems (insert standard disclaimers here . . . ) ColdFusion has always been excellent about maintaining backwards compatibility.
The only thing I know that has been dropped, and I think it was version 5 when it was dropped was doing
<cfset x = QueryNew()>
<cfif x>
has been depricated. So you might have to do some code trawling.
Another thing that may not be picked up by the Code Analyzer, and may or may not be an issue, is nesting of cfsetting enablecfoutputonly="True" or "False". It was a while ago, but I remember some crazy output issues with where those were set and where it was turned off.
The behavior of that setting with includes changed in that upgrade from 5, IIRC.
For ColdFusion 10, is Adobe documentation on the changes in since 5
Tag changes since CF5
New Functions in ColdFusion 10
Script functions implemented as CFCs
Script functions implemented as CFCs are all new since CF 9
Google does not really deliver much content (or my query sucks). Has anyone made the switch and can share the experience?
We found that when we upgraded to CF 8:
Carraige returns are stripped in plain text emails. We found we had to be explicit about line feed characters by creating a var like so <cfset CRLF = "#Chr(13)##Chr(10)#"> and inserting it in the plain text email where we needed the line feed. We eventually went to HTML emails.
Third party jar files caused problems due to the order in which jar files are loaded. Certain jar files must appear first in the java classpath as defined in cfroot/runtime/bin/jvm.config. This was a messy workaround and we have discontinued using that jar.
Also make sure to patch immediately to 8.0.1. We had a performance nightmare becuase of this issue.
Best of luck!
I haven't had any CFMX 6.1 apps to switch across, but Railo is definitely my CFML engine of choice.
Compatibility-wise, there is very unlikely to be any significant issues migrating from CFMX 6.1, and you can easily test this with the Express version - no installation required!
Railo can be stricter about certain aspects of CFML, so you might get a few errors if you exploit bugs/weaknesses with CF, but nothing really to worry about.
And, if you do get stuck on anything, the Railo mailing list is active with plenty of friendly helpful people who can help to get you going again.
We made the switch about a year ago and if you are talking about only on the code side, then the change from cf6 to cf8 shouldn't require any changes as long as your setup remains the same. One change is the way that CF handles verity collections, so if you make use of cfsearch then it might be something you look into. There are a number of improvements from cf6 that you should look to implement. The few that we have found especially helpful are cfdocument, cfimage, cfpdf, and cffeed. Here is a good link with other key points... http://www.adobe.com/products/coldfusion/upgrade/
If you are upgrading from CFMX 6.1 to Railo 3.1 almost no problems should occur. There are some things that we do not support (like CFREPORT or C++ CFX tags). Besides that it should be very easy to migrate existing CFMX 6.1 code over to Railo. By default Railo is configured to be as compatible as possible with CFMX.
There are some other things you might watch out for:
If you create a struct like this in CF: <cfset a["image.x"]> you will be able to call that variable by using the "." notation, although it's misleading. So in CF you could do <cfoutput>#a.image.x#</cfoutput> whereas in Railo you would have to write: <cfoutput>#a["image.x"]#</cfoutput>
Inside functions creating variables in the local scope that are named like scopes will work in CFMX but not in Railo. So this: <cfset var url = "whatever"> will work in CF but not in Railo.
In Railo you cannot use the application scope or the session scope before it was initialized with cfapplication. Well in CF you couldn't either but there CF will create a local variable in the variables scope called "application" or "session". This sometimes leads to confusion.
Besides these things, it should go flawlessly. If you have of course any problems, just contact our Railo Google group or us directly at www.getrailo.com
Gert Franz
Railo Professional Open Source
I'm not aware of any depreciated tags or functions from CF6.1 to CF8. CF8 has been optimized for performance so you will most likely see an improvement in your application depending on what was used.
I successfully upgraded a large application from CF4.5 to CF8 with no problems. If the application consists of pretty straight forward use of ColdFusion tags and functions, you shouldn't have much problem.
However, since the developer version is free to use, you should really setup a test environment and determine the answer to this question yourself by testing your application. All datasources, custom tags, etc will have to be migrated and tested. If any CF6.1 applications used any of the lower level java api available in some things, you may need to test that thoroughly to make sure the underlying implementation of the coldfusion hasn't changed and fix what's necessary.
As for Railo3.1, there may be some tags or functions not implemented yet. You will again need to setup a test environment and determine this yourself. Somewhere on the Railo site there should be a list of compatibilities between the difference versions of CF and Railo.