ID:               47707
 User updated by:  diepiapaopolopo at hotmail dot com
 Reported By:      diepiapaopolopo at hotmail dot com
 Status:           Bogus
 Bug Type:         Feature/Change Request
 Operating System: All
 PHP Version:      5.2.9
 New Comment:

Please consider the option of an ini setting
(collapse_tag_whitespace=yes|no|longtag) to enable the current behavior.
While the example you give is obviously going to happen occasionally, it
is certainly less likely than a user intending for everything outside
the PHP tags to remain intact. Even if the default behavior is still to
collapse the newline after the tag, having an ini option to not collapse
would be much better than the current work around (putting a space or an
additional newline after the closing tag).


Previous Comments:
------------------------------------------------------------------------

[2009-03-22 16:40:23] johan...@php.net

Not doing this might have unwanted effects in other cases - consider a
file starting with a PHP block and then some raw output.

We won't change this.

------------------------------------------------------------------------

[2009-03-18 18:12:50] diepiapaopolopo at hotmail dot com

Description:
------------
Can the decision to call bugs #13954 and #21891 bogus be revisited,
please?

Reproduce code:
---------------
<?
$quality="red";
?>
<p>Your apple is more <?=$quality?>
than mine.</p>

Expected result:
----------------
Your apple is more red than mine.

Actual result:
--------------
Your apple is more redthan mine.


Even though the behavior is documented
(http://www.php.net/manual/en/language.basic-syntax.instruction-separation.php),
swallowing a newline that immediately follows a closing tag seems to be
a pretty poor idea, especially if the rationale is to pretty up
formatting as is alluded to (http://bugs.php.net/bug.php?id=13954) by
jeroen.

Swallowing the newline is a surprise to anyone who encounters this bug
(yes, bug). Additionally, it can easily lead to malformatted output (see
sample included in this report). This malformatting can be difficult to
detect and the solution--adding a trailing space after every closing tag
(seriously???)--is a kludge through and through. This malformatting
becomes catastrophic if you're using PHP to generate input to another
program, as is the case for many of the people that have discussed the
issue over the years.

I realize this discussion has been going on for nearly a decade. I have
to assume this topic has become largely a political discussion, rather
than a problem solving one, because the problem hasn't been solved yet.

In the spirit of problem solving, several people have suggested adding
a setting to php.ini to re-enable the current behavior, which should
eliminate the need to refactor any scripts affected by the correction.
In any case, the current behavior should not be the default behavior.


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=47707&edit=1

Reply via email to