{"id":2283,"date":"2024-04-09T10:56:20","date_gmt":"2024-04-09T14:56:20","guid":{"rendered":"https:\/\/csimmons.dev\/blog\/?p=2283"},"modified":"2025-08-07T13:57:01","modified_gmt":"2025-08-07T17:57:01","slug":"coldfusion-unscoped-variables-and-how-to-find-them-using-the-new-patch","status":"publish","type":"post","link":"https:\/\/csimmons.dev\/blog\/2024\/04\/coldfusion-unscoped-variables-and-how-to-find-them-using-the-new-patch\/","title":{"rendered":"ColdFusion unscoped variables and how to find them (using the new patch)"},"content":{"rendered":"<p><em>Updated 08.07.2025 at the recommendation of a comment from <a href=\"https:\/\/www.carehart.org\/\" target=\"_blank\" rel=\"noopener\">Charlie Arehart<\/a><\/em><\/p>\n<p>On March 12, 2024 ColdFusion (2021 release) Update 13 introduced a change with significant implications for developers, particularly for developers managing older code that could be &#8220;leveraging&#8221; a &#8220;feature&#8221; of ColdFusion whereby ColdFusion would forgivingly &#8220;search&#8221; through scopes in a specific order if a variable name is not prefixed with a scope identifier.<\/p>\n<p>Rather than re-explain all the details here, Pete Freitag has a <a href=\"https:\/\/www.petefreitag.com\/blog\/cf-searchimplicitscopes\/\" target=\"_blank\" rel=\"noopener\">great write-up of the unscoped variable issue<\/a>.<\/p>\n<p>The <a href=\"https:\/\/helpx.adobe.com\/coldfusion\/kb\/coldfusion-2021-update-13.html\" target=\"_blank\" rel=\"noopener\">release notes for the update<\/a> also contain a section titled <strong>Significant changes in the release<\/strong> which details the issue and provides 2 options for &#8220;fixing&#8221; the issue.<\/p>\n<blockquote><p><strong>Option 1:<\/strong> Correct application code to fetch values from the correct scope.<\/p><\/blockquote>\n<p>This option is obviously the ideal one, but how do you locate the offending code? If you are fortunate enough to use <a href=\"https:\/\/fixinator.app\/\" target=\"_blank\" rel=\"noopener\">Fixinator<\/a> there is an option to scan for the issue. See <a href=\"https:\/\/www.petefreitag.com\/blog\/fixinator-unscoped-variable\/\" target=\"_blank\" rel=\"noopener\">this post<\/a> for how to use Fixinator.<\/p>\n<p>If you don&#8217;t have Fixinator you can implement Option 2 and then use the new patch provided by Adobe to help find issues.<\/p>\n<blockquote><p><strong>Option 2:<\/strong> Set searchimplicitscopes value back to TRUE.<\/p><\/blockquote>\n<p>This can be accomplished by doing the following <em>(Only one of these needs to be performed)<\/em>:<\/p>\n<ul>\n<li>Add the newly introduced flag, <strong>-Dcoldfusion.searchimplicitscopes=true<\/strong> to the jvm arguments <em>(This reverts the behavior at the jvm level (for all apps))<\/em><\/li>\n<li>Set searchimplicitscopes key to TRUE in Application.cfc or Application.cfm: <code>this.searchimplicitscopes = true<\/code> <em> (This explicitly reverts the behavior at the application level. The setting at the application level takes precedence over the JVM flag configured at the server level.)<\/em><\/li>\n<\/ul>\n<h2>Using the patch to find issues<\/h2>\n<p>Once you have Option 2 in place Adobe introduced a patch on April 1, 2024 to allow developers to view unscoped variables in a log file.<\/p>\n<p>Link to the patch: <a href=\"https:\/\/helpx.adobe.com\/coldfusion\/kb\/view-unscoped-variables-log-file.html\" target=\"_blank\" rel=\"noopener\">https:\/\/helpx.adobe.com\/coldfusion\/kb\/view-unscoped-variables-log-file.html<\/a><\/p>\n<h3>How to apply the patch<\/h3>\n<ol>\n<li>Copy the patch to <code>cfusion\/lib\/updates<\/code>.<\/li>\n<li>Restart ColdFusion.<\/li>\n<\/ol>\n<p>Once I had the patch in place I went to my application and just started using it. Within the first view pages the log file had entries.<\/p>\n<h3>How to view the log file<\/h3>\n<p>Navigate to the <code>\/cfusion\/logs<\/code> and locate the log file: <code>unscoped.log<\/code>. The unscoped variable is appended to the template name as <code>:VARIABLENAME<\/code><\/p>\n<p><code><br \/>\n\"Severity\",\"ThreadID\",\"Date\",\"Time\",\"Application\",\"Message\"<br \/>\n\"Information\",\"XNIO-1 task-2\",\"04\/09\/24\",\"09:32:12\",\"applicationName\",\"\/pathToApp\/render.cfm:BTNSUBMIT\"<br \/>\n\"Information\",\"XNIO-1 task-1\",\"04\/09\/24\",\"09:34:36\",\"applicationName\",\"\/pathToApp\/add.cfm:BTNSUBMIT\"<br \/>\n\"Information\",\"XNIO-1 task-2\",\"04\/09\/24\",\"09:35:24\",\"applicationName\",\"\/pathToApp\/edit.cfm:DETAILID\"<br \/>\n\"Information\",\"XNIO-1 task-2\",\"04\/09\/24\",\"09:35:24\",\"applicationName\",\"\/pathToApp\/edit.cfm:DETAILID\"<br \/>\n\"Information\",\"XNIO-1 task-2\",\"04\/09\/24\",\"09:35:30\",\"applicationName\",\"\/pathToApp\/edit.cfm:BTNSUBMIT\"<br \/>\n\"Information\",\"XNIO-1 task-2\",\"04\/09\/24\",\"09:35:49\",\"applicationName\",\"\/pathToApp\/received.cfm:BTNSUBMIT\"<br \/>\n\"Information\",\"XNIO-1 task-3\",\"04\/09\/24\",\"09:41:06\",\"applicationName\",\"\/pathToApp\/note.cfm:BTNSUBMIT\"<br \/>\n<\/code><\/p>\n<p>I&#8217;m going to implement this workflow and monitor the <code>unscoped.log<\/code> file daily to make corrections. Once some of the issues are identified in the <code>unscoped.log<\/code> file it becomes easier to use find\/replace for common issues in the codebase.<\/p>\n<p>For additional reading here is a good ColdFusion forum post: <a href=\"https:\/\/community.adobe.com\/t5\/coldfusion-discussions\/view-unscoped-variables-in-a-log-file\/m-p\/14527472#M197511\" target=\"_blank\" rel=\"noopener\">View unscoped variables in a log file<\/a><\/p>\n<p>As Charlie states in his comment it is worth noting that the JVM arg will be removed at some point:<\/p>\n<blockquote><p>Also, the Adobe resources at the time said (and some still say) that the JVM arg would be removed in the next major release (it would no longer work). That would be CF2025, which came out in Feb. Adobe relented on that, and the JVM arg DOES still work.<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Updated 08.07.2025 at the recommendation of a comment from Charlie Arehart On March 12, 2024 ColdFusion (2021 release) Update 13 introduced a change with significant implications for developers, particularly for developers managing older code that could be &#8220;leveraging&#8221; a &#8220;feature&#8221; of ColdFusion whereby ColdFusion would forgivingly &#8220;search&#8221; through scopes in a specific order if a &#8230; <a title=\"ColdFusion unscoped variables and how to find them (using the new patch)\" class=\"read-more\" href=\"https:\/\/csimmons.dev\/blog\/2024\/04\/coldfusion-unscoped-variables-and-how-to-find-them-using-the-new-patch\/\" aria-label=\"Read more about ColdFusion unscoped variables and how to find them (using the new patch)\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"_cloudinary_featured_overwrite":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[68],"tags":[48,12],"class_list":["post-2283","post","type-post","status-publish","format-standard","hentry","category-developer","tag-coldfusion","tag-developer"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pbVg43-AP","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/2283","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/comments?post=2283"}],"version-history":[{"count":0,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/posts\/2283\/revisions"}],"wp:attachment":[{"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/media?parent=2283"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/categories?post=2283"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/csimmons.dev\/blog\/wp-json\/wp\/v2\/tags?post=2283"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}