#30384 [Opn->Bgs]: PHP's HTML parser eats linefeeds

From: Date: Sun, 10 Oct 2004 19:56:36 +0000
Subject: #30384 [Opn->Bgs]: PHP's HTML parser eats linefeeds
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-67367@lists.php.net to get a copy of this message
ID: 30384 Updated by: mgf@php.net Reported By: septh at freesurf dot fr -Status: Open +Status: Bogus Bug Type: Output Control Operating System: Windows XP Pro PHP Version: 4.3.9 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#67367) next »