#30384 [NEW]: PHP's HTML parser eats linefeeds
| From: | septh at freesurf dot fr | Date: | Sun, 10 Oct 2004 17:31:35 +0000 |
| Subject: | #30384 [NEW]: PHP's HTML parser eats linefeeds | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-67366@lists.php.net to get a copy of this message | ||
From: septh at freesurf dot fr
Operating system: Windows XP Pro
PHP version: 4.3.9
PHP Bug Type: Output Control
Bug description: PHP's HTML parser eats linefeeds
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 bug report at http://bugs.php.net/?id=30384&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30384&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30384&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30384&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30384&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30384&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30384&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30384&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30384&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30384&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30384&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30384&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30384&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30384&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30384&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30384&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30384&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30384&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30384&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30384&r=mysqlcfg