Bug #9518 [Bgs]: Coding Standards should have no characters after ?>

From: Date: Fri, 08 Dec 2006 18:34:07 +0000
Subject: Bug #9518 [Bgs]: Coding Standards should have no characters after ?>
References: 1  Groups: php.pear.doc 
Request: Send a blank email to pear-doc+get-9024@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=9518&edit=1 ID: 9518 User updated by: michelo at rigadev dot com Reported By: michelo at rigadev dot com Status: Bogus Id: 9518 Type: Bug Package: Documentation Operating System: Windows XP PHP Version: 5.1.2 Assigned To: danielc New Comment: Most of the files that I have examined are fine but this seems to be at odds with coding standards which seem to require a single line feed after the closing ?>. Most of the PEAR .php files do not have a line feed after the closing ?>. Previous Comments: ------------------------------------------------------------------------ [2006-12-08 12:29:47] danielc at php dot net You're misunderstanding. The standards are correct and don't cause problems. Take a look at the PEAR DB files, for example. ------------------------------------------------------------------------ [2006-12-01 10:50:08] michelo at rigadev dot com Description: ------------ The english manual page on Coding Standards file formats, http://pear.php.net/manual/en/standards.file.php, states "There should be one line feed after the closing PHP tag (?>). This means that when the cursor is at the very end of the file, it should be one line below the closing PHP tag." I believe this is incorrect as it can lead to problems if a class file is included before the html headers are sent. This should be rewritten to state that no characters should appear before the opening <?php or after the closing ?> including line feeds and other control characters. Thanks, Test script: --------------- ---- source1.php ---- <?php ?> ---- source1.php end ---- ---- source2.php ----- <?php require_once('source1.php') header("HTTP:/1.0 404 Not Found"); ?> Expected result: ---------------- Warning: Cannot modify header information - headers already sent by (output started at www.example.com/source1.php:4) in www.example.com/source2.php on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=9518&edit=1

« previous php.pear.doc (#9024) next »