コンポーネントをアプリケーションスコープに配置して、すべてのリクエストで共有され、cfmテンプレートが含まれるようにします。
<cfcomponent output="false">
<cffunction name="run" output="false" returntype="void">
<cfset var tmp = false/>
<cftry>
<cfinclude template="inc.cfm"/>
<cfcatch>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="ERROR: #cfcatch.message#"/>
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>
含まれているテンプレートは、単に配列を作成し、配列の長さがファイルに書き込まれない場合は、配列の長さが正しいかどうかを確認しerror.log
ます。
<cfset tmp = [
"one",
"two",
"three"
]/>
<cfif ArrayLen(tmp) neq 3>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="Length = #ArrayLen(tmp)#"/>
</cfif>
次に、ロードを実行すると(100の同時スレッド)、error.log
ファイルに次のアイテムが表示されます...
ERROR: element at position 3 of array variable "___IMPLICITARRYSTRUCTVAR0" cannot be found.
Length = 0
Length = 2
Java1.7.0_09上でColdFusion9.0.1.274733を使用していることに注意してください。同じJREでRailoをテストしましたが、正常に動作します。
追加以下も問題を引き起こし、tmp
変数を構造体に変更し、variables
どこにも参照されていないスコープにランダムなアイテムを追加します...
<cfcomponent output="false">
<!---
Some random variable that does nothing with the exception
of being the facilitator of my eternal pain
--->
<cfset variables.t = {}/>
<cffunction name="run" output="false" returntype="void">
<cfset var tmp = {}/>
<cftry>
<cfinclude template="inc2.cfm"/>
<cfcatch>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="ERROR: #cfcatch.message#"/>
</cfcatch>
</cftry>
</cffunction>
</cfcomponent>
これには、最初のテンプレートと非常によく似た、次のようなテンプレートが含まれています...
<cfset tmp.arr = [
"one",
"two",
"three"
]/>
<cfif ArrayLen(tmp.arr) neq 3>
<cffile action="append"
file="#ExpandPath("error.log")#"
output="Length = #ArrayLen(tmp.arr)#"/>
</cfif>
variables
スコープ内のアイテムを削除すると、正常に機能します。テンプレートにダンプする#variables#
と#local#
、すべてが期待どおりの場所になります。
(コメントからの更新)
それ以来、この問題をバグとして提起しました#3352462