VarScoper Gotcha Example

So I grabbed a function from a cfc that we use (replaced sensitive data of course) and as you can see there are some non-scoped variables. When I run through the varscoper that I have (version 1.3 latest from RIAforge I believe) it doesn't catch some variables. First it says that Template and TemplatePath need to be var scoped but they are actually in the arguments scope not the local scope. Second of all it doesn't catch the returnVariable from the invoke on line 40 and then it also doesn't catch PeopleID on line 38. I figured the PeopleID is fine since it is in the argument scope, but if varscoper is supposed to catch unscoped arguments than this would be a problem anyways. I attached the example hopefully the line numbers are the same as in CFBuilder.

view plain print about
1<cfcomponent>
2    <cffunction name="PersonLayout">
3        <cfargument name="PersonID" required="yes">
4        <cfargument name="Page" required="no" default="">
5        <cfargument name="Template" required="no" default="">
6        <cfargument name="TemplatePath" required="no" default="">
7        <cfargument name="FullScreen" required="no" default="true">
8        <cfargument name="ColoredBackground" required="no" default="false">
9        <cfargument name="Breadcrumbs" required="no" default="#arrayNew(1)#">
10        
11        <cfset var FullPath = "" />
12        <cfset var Outerwidth = "" />
13        <cfset var InnerWidth = "" />
14        <cfset var personCrumb = "" />
15        
16        <cfif Template eq "">
17            <cfset Template = ListLast(CGI.PATH_INFO,"/")>
18            <cfset Template = Replace(Template,"dsp_","cnt_","All")>
19        </cfif>
20
21        <cfif TemplatePath eq "">
22            <cfset FullPath = request.URLHost & CGI.PATH_INFO>
23            <cfset TemplatePath = ReplaceNoCase(FullPath,request.URLRoot,request.TemplatePath,"")>
24            <cfset TemplatePath = ReplaceNoCase(TemplatePath,ListLast(CGI.PATH_INFO,"/"),"","")>
25        </cfif>
26        
27        <cfif FullScreen eq "true">
28            <cfset outerWidth="100%">
29            <cfset innerWidth="90%">
30        <cfelse>
31            <cfset outerWidth="700">
32            <cfset innerWidth="650">
33        </cfif>
34        
35        <cfinvoke
36            component="cfc_DA_Q_PeopleData"
37            method="getPeopleHeader"
38            PeopleID="#PeopleID#"
39            FieldList="FirstName"
40            returnVariable="getPersonInfo">

41        </cfinvoke>
42        
43        <cfscript>
44            personCrumb = structnew();
45            personCrumb.display = "person (#getPersonInfo.FirstName#)";
46            personCrumb.url = "People/Overview/dsp_viewPerson.cfm?PeopleID=#PeopleID#";
47            arrayprepend(Breadcrumbs,personCrumb);
48        
</cfscript>
49        
50        <cfoutput>
51        <table width="100%" style="height: 100%" cellpadding="0" cellspacing="0" border="0">
52            <tr>
53                <td nowrap valign="top" id="SideMenu" width="200" rowspan="2">
54                    #PeopleMenu(arguments.PeopleID,arguments.Page,breadcrumbs)#
55                </td>
56                <td style="padding:0px;" valign="top"><cf_tag_Breadcrumbs2 Breadcrumbs="#Breadcrumbs#"></td>
57            </tr>
58            <tr>
59                <td width="100%" valign="top" colspan="2">
60                    <table width="#outerWidth#" cellpadding="8" cellspacing="0" border="0" align="center">
61
62                        <tr>
63                            <td>
64                                <cfif ColoredBackground>
65                                    <cf_tag_RoundedCornersTop bgcolor="##E9E9E9">
66                                </cfif>
67                                <table width="100%" cellspacing="0" cellpadding="0" border="0" <cfif ColoredBackground>class="roundtable" style="background-color:##E9E9E9;"</cfif>>
68                                    <tr>
69                                        <td>
70                                            <div id="outerContent">
71                                            <table width="#innerWidth#" cellpadding="8" cellspacing="0" border="0" align="center">
72                                                <tr>
73                                                    <td>
74                                                        <cf_tag_personHeader
75                                                            PeopleID="#PeopleID#"
76                                                            getQueries="true"
77                                                            showHealth="#request.config.personShowHealthIndicator#">

78                                                    </td>
79                                                </tr>
80                                                <tr>
81                                                    <td>
82                                                        <div id="innerContent">
83                                                            <cfinclude template="#TemplatePath##Template#">
84                                                        </div>
85                                                    </td>
86                                                </tr>
87                                            </table>
88                                            </div>
89                                        </td>
90                                    </tr>
91                                </table>
92                                <cfif ColoredBackground>
93                                    <cf_tag_RoundedCornersBottom bgcolor="##E9E9E9">
94                                </cfif>
95                            </td>
96                        </tr>
97                    </table>
98                    <cf_tag_personFooter>
99                </td>
100            </tr>
101        </table>
102        </cfoutput>
103
104    </cffunction>
105</cfcomponent>

Related Blog Entries

TweetBacks
Comments (Comment Moderation is enabled. Your comment will not appear until approved.)
BlogCFC was created by Raymond Camden. This blog is running version 5.9.6.004. Contact Blog Owner