Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Duplicating Arguments in CF9

Engaged ,
May 17, 2010 May 17, 2010

In cf7 and cf8 if you do the following:-

<cffunction name="duplicateIssue" access="public" output="false" returntype="void" hint="">
        <cfargument name="arg1" type="string" required="true" hint="">
        <cfargument name="arg2" type="string" required="true" hint="">
        <cfargument name="arg3" type="string" required="true" hint="">
        <cfset var local            = duplicate(arguments)>
        <cfset var local2            = duplicate(arguments)>
        <cfdump var="#local#">
        <cfdump var="#local2#">
        <cfabort>
</cffunction>

<cfset duplicateIssue()>

They will output the same. However, in CF9 the first assignment to local is ignored and the local scope is populated. This means that the current application I work on cannot be migrated to CF9, as there are lots of occurances where the arguments scope is being duplicated into a struct called local. I know why this was added in CF9 to make life apprently easier for people who don't like varring things but it has changed the behaviour quite drastically and will take a lot of chages and testing for me to upgrade.

Any advice would be greatly appreciated,

Simon

386
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 17, 2010 May 17, 2010

You could always be brave and try a global replacement of the word local to something else.  You still have to test everything of course but wouldn't you be doing that anyway?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
May 17, 2010 May 17, 2010
LATEST

Yeah, I know I could do that. I was just trying to not end up doing something that drastic. It was an informatiojn gathering exercise. On further investigation it appears that if you assign anything to local it just ignores it, which is a total disaster. So you can't do this either:-

<cfset local = getProperties()>

It just totally ignores that line. I don't feel like this is much of a feature!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources