From: docuk at gmx dot net Operating system: All PHP version: 5.2.5 PHP Bug Type: Feature/Change Request Bug description: Configuration directive for PHP blocks eating newlines
Description: ------------ Currently, PHP eats newlines following end tags as specified in the FAQ (http://us.php.net/manual/en/faq.using.php#faq.using.newlines). The documentation's justification for this feature is to make the HTML output more readable, but the reality is different (see Reproduce code section). This is bearable because web browsers ignore this whitespace combination anyways, but for text output this causes a lot of headaches. I propose that the real reason for this feature is to prevent the "Headers already sent" error, such as in: <?php /* some PHP code here */ ?> <?php session_start(); ?> PHP should have a configuration directive to disable this newline-stripping behavior, default to the old behavior for backwards compatibility if need be. This is way overdue. References: http://bugs.php.net/bug.php?id=20556 http://shiflett.org/blog/2005/oct/php-stripping-newlines http://bradchoate.com/weblog/2007/05/10/php-and-newline-characters Reproduce code: --------------- <table> <tr> <td> <?php echo 'TEST'; ?> </td> </tr> </table> becomes <table> <tr> <td> TEST </td> </tr> </table> -- Edit bug report at http://bugs.php.net/?id=43833&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43833&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43833&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43833&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43833&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43833&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43833&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43833&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=43833&r=needscript Try newer version: http://bugs.php.net/fix.php?id=43833&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43833&r=support Expected behavior: http://bugs.php.net/fix.php?id=43833&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43833&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43833&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43833&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43833&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43833&r=dst IIS Stability: http://bugs.php.net/fix.php?id=43833&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43833&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43833&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43833&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=43833&r=mysqlcfg