CFHTMLHEAD is not bug compatible with ACF

Description

When using CFHTMLHEAD and there is no <head> tag defined in the response, ACF is inserting the value of CFHTMLHEAD above all content at the beginning of the response stream. Lucee just ignors it.

Environment

None

Activity

Show:

Igal Sapir 7 November 2016 at 17:43

Ideally, the htmlhead will be added before the debug-output is added, and that would be the cleanest solution IMO

Igal Sapir 30 October 2016 at 18:36

It would be much more complicated to ignore the debug template's output as it will require many more changes to the code.

If whitespace is allowed in closing html tags, then we can set in the debug template "</ head>" which will then not match the substring search.

We can also remove "</head>" from the debug templates, sure.

Let's keep in mind that there is an easy workaround: add the <head></head> tags in your cfml template.

Brad Wood 30 October 2016 at 12:50

I would think the htmlhead tag should just ignore any output that's part of the debug template (maybe reverse the order they're added).

Michael Offner 30 October 2016 at 10:26

Htmlhead could ignore end head defined in the debug template or we rewrite debug template and we remove the end head from there.

Igal Sapir 30 October 2016 at 05:26

OK, I see the problem.

The way that cfhtmlhead works is that at the end of the request, Lucee searches for the substring "</head>" and injects the contents of cfhtmlhead just before it. If the substring "</head>" is not found, then the content is prepended to the beginning of the output stream.

When Debug Output is enabled, the debug template, e.g. Modern.cfc, contains in it a bunch of closing tags, one of which is the </head> tag, and therefore if the cfml template does not contain its own "</head>", then the substring that is found is the one that comes from the debug template, and then the content is injected below the bottom of the page, somewhere in the beginning of the debug template.

TBH I'm not sure if that is something that we want to fix. Need discussion.

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

Affects versions

Created 6 March 2015 at 18:05
Updated 25 February 2022 at 11:56