[TYPO3-core] CGL proposal: Dropping the closing PHP tag
patrick.broens at typo3.org
Mon Oct 22 16:30:22 CEST 2012
Thanks for your explanation. This changes the way I look at this topic.
I was for removing the closing tag, but when I read your explanation I
get a totally different view on this topic. I love valid documents and
this XML needs to be valid as well. Didn't think what the syntax was all
Thanks for pointing in the right direction
TYPO3 Core Team member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
On 22-10-12 15:49 , Stefano Kowalke wrote:
> as one of the PHP_CodeSniffer Leader who implements the CGL rules I want
> to give some background about this topic.
> I assume that we agreed to common PHP opening and closing tags (<?php
> ?>). Not to the short (<? ?>) or asp (<% %>) variants.
> By using these tags, you do using a so called XML Processing Instruction
> The normal syntax is <?PITARGET PICONTENT?> where PITARGET is in our
> case the string php, which is an directive for the XML parser and as
> every XML tag must be closed, these tags must closed too. (You can see
> this in the tag definition at )
> Voting for not closing the php tag, you vote for an invalid XML syntax.
> If it hurts anyone, I have to say: "I don't know".
> I believe that the rules in Zend or Drupal for remove the tag are only
> for lazy devs and for convenience to avoiding "header always sent"
> problems raised by a whitespace after the closing php tag.
> Just my two cents.
> @Steffen: We have to remove the rule, then we can remove the check.
>  http://en.wikipedia.org/wiki/Processing_Instruction
>  http://www.w3.org/TR/REC-xml/#sec-pi
> Am 20.10.12 15:41, schrieb Andreas Wolf:
>> I'd like to propose a change to our CGL to get rid of the closing PHP tag.
>> I don't see a good reason why it is there, but it creates a lot of
>> hazzle with our "no trailing newline" rule, especially when doing a
>> quick fix without an IDE (I don't control these settings in every
>> editor I use).
>> Dropping the closing tag will make sure that no content in the PHP
>> file can slip into the output (which is AFAIK at least one main reason
>> why we have the "no newline"-rule).
>> What's your opinion on that?
More information about the TYPO3-team-core