[wp-trac] [WordPress Trac] #10633: Omit closing PHP tag at the end of a file when using include() or require()
WordPress Trac
wp-trac at lists.automattic.com
Thu Sep 10 07:52:10 UTC 2009
#10633: Omit closing PHP tag at the end of a file when using include() or require()
-------------------------+--------------------------------------------------
Reporter: hakre | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 2.9
Component: General | Version: 2.8.4
Severity: normal | Keywords: has-patch dev-feedback
-------------------------+--------------------------------------------------
Changes (by hakre):
* version: 2.9 => 2.8.4
* milestone: Future Release => 2.9
Comment:
Replying to [comment:6 dd32]:
> > You're kidding, right? Having "?>" is no proof of a fully uploaded
file, that argument sounds not very serious to me.
>
> To a technical user yes. But to a non-PHPer, No. Quite often people will
ask why wp-config.php doesnt have it, as they think it means its not fully
there.
Then put a comment in there. This would also help in terms to signal a
propper end. And having this documented in the coding styles can help as
well.
> Whitespace immediately following a ?> is ignored by PHP and not
rendered, However, Multiple new lines are not ignored (Single is fine,
multiple is not).
From php.net, the official documentation: "so unwanted whitespace will not
occur at the end of files, and you will still be able to add headers to
the response later." Its written as an argument to ''not'' use ?> at the
end, so I think it will be much safter to do according the official
documentation then to isolated tests. So I suggest to stick with the
official recommendation to remove it for includes / requires.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10633#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list