Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

CF2021 custom tags do not support null values

Community Beginner ,
Mar 10, 2022 Mar 10, 2022

x = null

if (x != null) {}

 

Both of these statments fail when used in a custom tag.  Both statements succeed when using in the requested template or a template that is included in another template.

 

This issue occurs when using tag or script syntax.

 

Can anyone else reproduce this issue?

 

Version: 2021,0,03,329779

 

Message: Variable NULL is undefined. 

Stack Trace: coldfusion.runtime.UndefinedVariableException: Variable NULL is undefined. at coldfusion.runtime.CfJspPage._get(CfJspPage.java:462) at coldfusion.runtime.CfJspPage._get(CfJspPage.java:417) at coldfusion.runtime.CfJspPage._get(CfJspPage.java:396) at coldfusion.runtime.CfJspPage._autoscalarize(CfJspPage.java:2363) at cfrendercourse2ecfm589117369.runPage(C:\home\evansville.edu\custom-tags\course\rendercourse.cfm:2) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257) at coldfusion.filter.CFVariablesScopeFilter.invoke(CFVariablesScopeFilter.java:56) at coldfusion.tagext.lang.ModuleTag.doStartTag(ModuleTag.java:330) at coldfusion.runtime.CfJspPage._emptyTcfTag(CfJspPage.java:5201) at cfcourses2ecfm1575386829.runPage(C:\home\evansville.edu\wwwroot\majors\chemistry\courses.cfm:109) at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:257) at coldfusion.tagext.lang.IncludeTag.handlePageInvoke(IncludeTag.java:749) at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:578) at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65) at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:573) at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:43) at coldfusion.filter.MonitoringFilter.invoke(MonitoringFilter.java:40) at coldfusion.filter.PathFilter.invoke(PathFilter.java:162) at coldfusion.filter.IpFilter.invoke(IpFilter.java:45) at coldfusion.filter.ExceptionFilter.invoke(ExceptionFilter.java:97) at coldfusion.filter.ClientScopePersistenceFilter.invoke(ClientScopePersistenceFilter.java:28) at coldfusion.filter.BrowserFilter.invoke(BrowserFilter.java:38) at coldfusion.filter.NoCacheFilter.invoke(NoCacheFilter.java:60) at coldfusion.filter.GlobalsFilter.invoke(GlobalsFilter.java:38) at coldfusion.filter.DatasourceFilter.invoke(DatasourceFilter.java:22) at coldfusion.filter.CachingFilter.invoke(CachingFilter.java:62) at coldfusion.CfmServlet.service(CfmServlet.java:231) at coldfusion.bootstrap.BootstrapServlet.service(BootstrapServlet.java:311) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:228) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) at coldfusion.monitor.event.MonitoringServletFilter.doFilter(MonitoringServletFilter.java:46) at coldfusion.bootstrap.BootstrapFilter.doFilter(BootstrapFilter.java:47) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:190) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:163) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:143) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:373) at org.apache.coyote.ajp.AjpProcessor.service(AjpProcessor.java:462) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:893) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1723) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.base/java.lang.Thread.run(Thread.java:834) 

422
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Mar 16, 2022 Mar 16, 2022

It was a .cfm file.

I was able to confirm the issue again today.  I reported it in Adobe's bug tracker.

Thanks!

Translate
Community Expert ,
Mar 15, 2022 Mar 15, 2022

I tested both statements

  • in a requested CFMtemplate
  • in a template that is included in another template.

The code failed in both situations. The error was "Variable NULL is undefined". I, too, am on Coldfusion 2021 Update 3.

 

Did you mistakenly test with a non-CFM page?

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 16, 2022 Mar 16, 2022

It was a .cfm file.

I was able to confirm the issue again today.  I reported it in Adobe's bug tracker.

Thanks!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 18, 2022 Mar 18, 2022
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 16, 2022 Mar 16, 2022

This may be a silly question, but I believe that null support is a setting you have to enable. Did you enable it? If so, is it enabled at the server level? Or, in the `Application.cfc`?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 16, 2022 Mar 16, 2022

Yes, null support is enabled in Application.cfc.

 

Null-related code works everywhere except within a custom tag.  This is a bummer because my custom tags are exactly where I want to use nulls.  For example, I need to check for a non-null value from a nullable column.

 

This code works in an "included" template:

<cfif articles.story != null>#articles.story#</cfif>

However, it does not work when that template is called as a custom tag.

 

Thanks for asking!

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2022 Mar 17, 2022

You could, while this is being investigated, use

JavaCast("null","")

as null value.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 17, 2022 Mar 17, 2022

Yes, JavaCast() will work if you are setting a nullable value.

 

However, JavaCast() can't be used when expecting nullable columns from a database query.

 

Thanks for voting on this bug.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2022 Mar 17, 2022

I could reproduce the issue and have duly voted for your bug.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources