GetBaseTemplatePath() errors in JSR-223 context

Description

When calling the getBaseTemplatePath() function from JSR-223 (in a CommandBox task runner, for example) an error is thrown:

I get that is technically correct but this makes some CFML modules impossible to use from the CLI if they use that method and there's no good way to test if the method will work or not other than just wrapping it in a try/catch. I noticed that the cgi.script_name is spoofed to just show /index.cfm from JSR-223. Can this function return the same spoofed path? Or, even better, return the first included file. For instance, all of CommandBox runs inside of a Bootstrap.cfm file which would be a logical response from that function.

Related bug in MockData.cfc library which won't work inside CommandBox currently:
https://github.com/Ortus-Solutions/MockDataCFC/pull/3/files#diff-b5c2bad68f4807cad3b65e1b4831d9afL112

Environment

None

Attachments

1

Activity

Brad Wood 23 October 2018 at 04:36

Thanks for the fix!

Michael Offner 19 October 2018 at 07:49

for me the question is what is the base template in that case. In my opinion it is the most top file in the stacktrace, sure if there is no file at all, we can make one up, but if the most top file is bootstrap.cfm, we should return that one, much better than throwing an exception!

Pothys - MitrahSoft 24 September 2018 at 14:46

I've analyzed this ticket & confirmed the issue in lucee. I tested with command box task runner on commandBox & Issue occurs while using GetBaseTemplatePath() function, but the same way GetCurrentTemplatePath() function returns as expected.

I attached my stacktrace.txt

Fixed

Details

Assignee

Reporter

Priority

Fix versions

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

Sprint

Created 23 September 2018 at 05:20
Updated 1 April 2019 at 20:31
Resolved 19 October 2018 at 14:20