[documentation] [Documentation bug] Coding standards cleanup: confusing page 545

forngren drupal-docs at drupal.org
Fri Dec 15 20:49:25 UTC 2006


Issue status update for 
http://drupal.org/node/103515
Post a follow up: 
http://drupal.org/project/comments/add/103515

 Project:      Documentation
 Version:      <none>
 Component:    Developer Guide
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  forngren
 Updated by:   forngren
 Status:       active

http://drupal.org/node/545 says


"
Always use <?php
 
?> to delimit PHP code, not the  shorthand. This is required for Drupal
compliance and is also the most portable way to include PHP code on
differing operating systems and setups.


Note that as of Drupal 4.7, the ?> at the end of code files (modules,
includes, etc.) is purposely omitted. The full discussion that led to
this decision is available from the no ?> needed at the end of modules
discussion on the drupal-devel mailing list, but can be summarized as:


    * Removing it eliminates the possibility for unwanted whitespace at
the end of files which can cause "header already sent" errors, XHTML/XML
validation issues, and other problems.
    * The closing delimiter at the end of a file is optional.
    * PHP.net itself removes the closing delimiter from the end of its
files (example: prepend.inc), so this can be seen as a "best practice."


"
(no comments on this page)


while the coding standards [1] says:


"
Always use <?php
 
?> to delimit PHP code, not the  shorthand. This is required for Drupal
compliance and is also the most portable way to include PHP code on
differing operating systems and setups.


Note that the final ?> should be omitted from all code files--modules,
includes, etc. The closing delimiter is optional, and removing it helps
prevent unwanted white space at the end of files which can cause
problems elsewhere in the system. More information is available from the
PHP Code tags portion of the handbook.


"
I suggest that the text from 545 should replacing the one in coding
standards main page and then 545 should be removed. We may also want to
skip the reference to Drupal 4.7 since 5.x is almost arround.
[1] http://drupal.org/node/318




forngren



More information about the documentation mailing list