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

Always use 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 says:

Always use 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.

Comments

Gary Feldman’s picture

The no >? needed at the end of modules discussion can be found in the archives at http://lists.drupal.org/archives/development/2005-08/msg00648.html. I suggest putting that link in explicitly.

jstarbow’s picture

Assigned: Unassigned » jstarbow

I'll look into this as part of the Coding Standards clean-up.

dokumori’s picture

Project: Documentation » Drupal core
Version: » 7.x-dev
Component: Developer Guide » documentation

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443
-dokumori

dokumori’s picture

Project: Drupal core » Documentation
Version: 7.x-dev »
Component: documentation » Correction/Clarification
heather’s picture

Status: Active » Fixed

The coding standards pages has been updated, and the information from node/545 has been integrated with the link mentioned above.

This is fixed!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.