#30384 [Com]: PHP's HTML parser eats linefeeds
| From: | emin dot eralp at bg dot com dot tr | Date: | Tue, 12 Oct 2004 11:47:16 +0000 |
| Subject: | #30384 [Com]: PHP's HTML parser eats linefeeds | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67470@lists.php.net to get a copy of this message | ||
ID: 30384
Comment by: emin dot eralp at bg dot com dot tr
Reported By: septh at freesurf dot fr
Status: Bogus
Bug Type: Output Control
Operating System: Windows XP Pro
PHP Version: 4.3.9
New Comment:
I have the same problem with line feeds not appearing. The following
results give the same output. I cannot seem to insert a line feed when
using echo. Here is the code:
<?php
echo "line 1";
echo "\n";
echo "line 2\n";
echo "line 3\n\r"
?>
Here is the output:
line 1 line 2 line 3
Windows XP Pro, PHP 5.0.0.1, IE Version 6.0.2900, IIS
Previous Comments:
------------------------------------------------------------------------
[2004-10-10 21:56:34] mgf@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
It\'s documented behaviour.
------------------------------------------------------------------------
[2004-10-10 19:31:32] septh at freesurf dot fr
Description:
------------
When parsing HTML source code, PHP seems to "eat" the linefeed after
the ?> marker.
Tested on Windows XP Professional SP1 with Apache 1.3.31 and PHP 4.3.9.
Unfortunately, I can't test it with any other versions (I do not have
administrator access to the machine).
Reproduce code:
---------------
File test.php :
---------------
<html>
<head><title>Test</title></head><body>
<pre style="border: 1px solid black;">
line 1
<?php echo "line 2"; ?>
line 3
<?php echo "line 4"; ?>
line 5
</pre>
</body>
</html>
Expected result:
----------------
line 1
line 2
line 3
line 4
line 5
Actual result:
--------------
line 1
line 2line 3
line 4line 5
Note 1: Ok, I realize there are no "\n" ni my echo statements. However,
there *is* a linefeed after each ?> in the HTML code, and I wouldn't
expect PHP to remove them.
Note 2: by adding an extra character after the ?> (say, a space char),
the ouput is correct.
Note 3: the problem arises whether I save the test.php file with
PC-style (\n), Unix-style (\r\n), or Mac-style (\r) linefeeds.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30384&edit=1