Well, template files usually do end with closing php tags. This patch makes the function skip files ending on '.tpl.php'.

Comments

eMPee584’s picture

Mhh, the function name changed, why? Shall i rebase the patch or do you have conflicting plans with that function?

eMPee584’s picture

Status: Needs review » Closed (fixed)

uhhm just to explain, this issue comes only up in a single of my file which is comment-wrapper.tpl.php. That uses an enclosing php if statement which surpresses all output if the comment count is zero. Anyways, i think i can live with it.

stella’s picture

Status: Closed (fixed) » Needs review

I still want to investigate this further.

eMPee584’s picture

StatusFileSize
new1.26 KB

well if you really do care here's my template file, it really is just the default from the comment module with the additional surrounding if clause to surpress the header output if no comments are present...

barraponto’s picture

confirm: indeed, it only warns on comment wrapper template. i'm using a zen sub theme.

douggreen’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev

I would like more feedbqck from themers on this and preferably a link to drupal docs with the template exception.

anoopjohn’s picture

Issue summary: View changes

I can confirm that none of the templates in core themes in D7.x has an ending ?>.

I can however think of a scenario where this is going to happen. When a template file has a last line like

<?php print $content; ?&gt;

I see that some of the template files in core does indeed end like this eg: forum-topic-list.tpl.php

Running phpcs on the forum module in D7 however does not return this error on any of the template files.

klausi’s picture

Version: 7.x-2.x-dev » 8.x-2.x-dev
Status: Needs review » Closed (works as designed)

In Coder 8.x-2.x we disable the sniff in ruleset.xml for *.tpl.php files, so this should work fine there. Please test again with Coder 8.x-2.x, which can also be used to check Drupal 7 code.