Req #43833 [Opn->Wfx]: Configuration directive for PHP blocks eating newlines
| From: | requinix@php.net | Date: | Sat, 05 May 2018 19:31:08 +0000 |
| Subject: | Req #43833 [Opn->Wfx]: Configuration directive for PHP blocks eating newlines | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215085@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=43833&edit=1
ID: 43833
Updated by: requinix@php.net
Reported by: docuk at gmx dot net
Summary: Configuration directive for PHP blocks eating
newlines
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: All
PHP Version: 5.2.5
Block user comment: N
Private report: N
New Comment:
Adding an INI directive should involve discussion first. https://wiki.php.net/rfc/howto
Closing wontfix due to age and the rising popularity of templating over the last few years. This can
be reopened if there's interest in the requested feature.
Previous Comments:
------------------------------------------------------------------------
[2008-01-13 21:22:33] docuk at gmx dot net
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 this bug report at https://bugs.php.net/bug.php?id=43833&edit=1