[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
Mon Aug 17 09:33:27 UTC 2009
#10633: Omit closing PHP tag at the end of a file when using include() or require()
--------------------------+-------------------------------------------------
Reporter: hakre | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: General | Version:
Severity: normal | Keywords:
--------------------------+-------------------------------------------------
The closing tag of a PHP block at the end of a file is optional, and in
some cases omitting it is helpful when using include() or require(), so
unwanted whitespace will not occur at the end of files, and you will still
be able to add headers to the response later. It is also handy if you use
output buffering, and would not like to see added unwanted whitespace at
the end of the parts generated by the included files. (Source:
http://www.php.net/manual/en/language.basic-syntax.instruction-
separation.php)
Because this is proposed by PHP.net and a well known good practice, this
closing tag should be removed from files that are included/required only.
Additionally I suggest to add this to the Coding Standards: Omit closing
php tag. This is a usefull hint for any PHP developer.
References: #10577, #10106, #8621, #7685, #7524, #7149, #6791, #4901,
[856]
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10633>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list