unscoped thread variable not being found
Description
Environment
Attachments
- 20 Mar 2020, 10:13 am
- 20 Mar 2020, 10:12 am
- 20 Mar 2020, 10:12 am
- 20 Mar 2020, 10:11 am
is cloned by
Activity
Zac Spitzer 28 October 2022 at 13:48
Zac Spitzer 18 October 2022 at 15:36
moved the second part of this original ticket to https://luceeserver.atlassian.net/browse/LDEV-4244
Pothys - MitrahSoft 18 October 2022 at 13:37Edited
@Michael Offner @Zac Spitzer I think we have to add a new check and use pc.getCurrentThreadScope()
to search the undefined scope inside the thread.
https://trycf.com/gist/70a93d54de43ba4df2202c6abc2f58bb/lucee5?theme=monokai
// search in the thread scope
if (pc.hasFamily() && ((PageContextImpl) pc).getCurrentThreadScope() != null) {
rtn = ((PageContextImpl) pc).getCurrentThreadScope().get(key, _null);
if (rtn != _null) {
if (debug && !((PageContextImpl) pc).isThreads(rtn)) debugCascadedAccess(pc, "thread", key);
return rtn;
}
}
Pothys - MitrahSoft 18 October 2022 at 12:30
@Michael OffnerInside the thread while searching for the undefined variable, the UndefinedImpl class pc.getThreadScope(key, _null)
searches for the child threads and it returns the child thread if it exists, not thread scope.
https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L222
Example: https://trycf.com/gist/5b2e61bda178224bff3d423807de9fdf/lucee5?theme=monokai
Zac Spitzer 18 October 2022 at 11:02Edited
testcase for accessing a unscoped thread scope variable inside a thread
https://github.com/lucee/Lucee/pull/1850
[java] [script] testThreadUnscopedVar
[java] [script]
[java] [script] Errored: variable [TEST2773] doesn't exist
[java] [script]
[java] [script] C:\work\lucee6\test\tickets\LDEV2773.cfc:9
[java] [script]
[java] [script]
[java] [script] lucee.runtime.exp.ExpressionException: variable [TEST2773] doesn't exist
[java] [script]
[java] [script] at lucee.runtime.type.scope.UndefinedImpl.get(UndefinedImpl.java:243)
[java] [script] at lucee.runtime.type.scope.UndefinedImpl.get(UndefinedImpl.java:184)
[java] [script] at tickets.ldev2773_cfc$cf.threadCall(/test/tickets/LDEV2773.cfc:9)
[java] [script] at lucee.runtime.thread.ChildThreadImpl.execute(ChildThreadImpl.java:206)
[java] [script] at lucee.runtime.thread.ChildThreadImpl.run(ChildThreadImpl.java:147)
Details
Assignee
Michael OffnerMichael OffnerReporter
Zac SpitzerZac SpitzerPriority
NewNew Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
Affects versions
Details
Details
Assignee
Reporter
Priority
New Issue warning screen
Before you create a new Issue, please post to the mailing list first https://dev.lucee.org
Once the issue has been verified, one of the Lucee team will ask you to file an issue
unscoped, thread scoped variables aren't being resolved inside a thread
https://docs.lucee.org/guides/developing-with-lucee-server/scope.html
https://github.com/lucee/Lucee/blob/5.3/core/src/main/java/lucee/runtime/type/scope/UndefinedImpl.java#L215