ID: 41281 User updated by: fantasticjamieburns at hotmail dot com Reported By: fantasticjamieburns at hotmail dot com -Status: Closed +Status: Open Bug Type: Documentation problem Operating System: Linux/Windows PHP Version: 4.4.7 New Comment:
... Previous Comments: ------------------------------------------------------------------------ [2007-05-04 11:39:34] fantasticjamieburns at hotmail dot com Ooops. closed. ------------------------------------------------------------------------ [2007-05-04 11:39:08] fantasticjamieburns at hotmail dot com Thanks for taking the time to look at this anyway. For anyone else reading this in the future and thinking this is crazy behaviour this quickly gets around it for evaluated code: $source = preg_replace('#<\?php (.*?) \?>\n#', "<?php \\1 ?>\n\n", $source); $source = preg_replace('#<\?php (.*?) \?>\r\n#', "<?php \\1 ?>\r\n\r\n", $source); :o) ------------------------------------------------------------------------ [2007-05-04 11:26:49] [EMAIL PROTECTED] The manual also states (at http://php.net/manual/en/language.basic-syntax.instruction-separation.php): "The closing tag for the block will include the immediately trailing newline if one is present." ... and this has been the case forever. However, I agree that it would probably be useful to modify the text you quoted to read something like: "... when PHP hits the ?> closing tags, it simply starts outputting whatever it finds (except for an immediately following newline) until it hits another opening tag." ... so I'm leaving this open as a Documentation Problem! ------------------------------------------------------------------------ [2007-05-04 11:21:37] fantasticjamieburns at hotmail dot com OK, thanks for classifying this as a documentation problem. If it is indeed the case that a PHP end tag considers a newline to be "part of the end tag" then I must say that is really dumb. It breaks all sorts of simple things like: <pre> - <?php echo("jack"); ?> - <?php echo("jill"); ?> </pre> Now why on earth would PHP think it has the right to take away a newline character OUTSIDE of the end tag? In every other case the end tag finishes with the less-than symbol, no? Now, if a newline is now part of the close tag, why not a space? <?php echo('jack'); ?> <?php echo("jill"); ?> Does the space now also get taken by PHP? Or is it outside the PHP blocks? And if it is outside, is it not because it is beyone the less-than symbol of the first block? ------------------------------------------------------------------------ [2007-05-04 11:03:36] [EMAIL PROTECTED] Reclassified as docu problem. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/41281 -- Edit this bug report at http://bugs.php.net/?id=41281&edit=1