#28381 [Opn->Bgs]: <?= $variable ?> eats up a newline if it follows ?>
| From: | mgf@php.net | Date: | Thu, 13 May 2004 08:19:13 +0000 |
| Subject: | #28381 [Opn->Bgs]: <?= $variable ?> eats up a newline if it follows ?> | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59571@lists.php.net to get a copy of this message | ||
ID: 28381
Updated by: mgf@php.net
Reported By: mikemc-phpbug2 at contactdesigns dot com
-Status: Open
+Status: Bogus
Bug Type: Scripting Engine problem
Operating System: Linux 2.4.20-28.9smp
PHP Version: 4.3.6
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
Expected behaviour, documented at http://www.php.net/basic-syntax ("The
closing tag for the block will include the immediately trailing newline
if one is present.")
Previous Comments:
------------------------------------------------------------------------
[2004-05-13 05:50:43] mikemc-phpbug2 at contactdesigns dot com
Almost forgot the workaround! You can insert a space right after "?>"
and the newline gets output.
Yes it is specific to newlines for example, this:
<?= $_SERVER['PHP_SELF'] ?>*
I should be on a new line - but I am not!
Outputs this:
testing.php*
I should be on a new line - but I am not!
So PHP only seems to eat the newline - it ignores the "*". Wonder if
there are any other characters it doesn't like?
------------------------------------------------------------------------
[2004-05-13 05:44:52] mikemc-phpbug2 at contactdesigns dot com
Description:
------------
This isn't a major bug, but I would think it should be classified as a
bug just so that it is on the radar screen. For those of us too lazy
to write <?php echo $variable ?> and instead prefer <?= $variable ?>,
if a newline immediately follows the "?>" then PHP eats the new line
:-(
Reproduce code:
---------------
vi test.php (then insert following code and :wq Enter)
<?= $_SERVER['PHP_SELF'] ?>
I should be on a new line - but I am not!
[shellprompt]# php test.php
testing.phpI should be on a new line - but I am not!
Expected result:
----------------
testing.php
I should be on a new line - but I am not!
Actual result:
--------------
testing.phpI should be on a new line - but I am not!
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28381&edit=1