Doc #76316 [NEW]: fail to print newline after end tag in included file

From: Date: Wed, 09 May 2018 10:15:44 +0000
Subject: Doc #76316 [NEW]: fail to print newline after end tag in included file
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15674@lists.php.net to get a copy of this message
From: divinity76 at gmail dot com Operating system: linux, debian 10 x64 k4.16.5-1 PHP version: 7.2.5 Package: Unknown/Other Function Bug Type: Documentation Problem Bug description:fail to print newline after end tag in included file Description: ------------ reading the docs at http://php.net/manual/en/language.basic-syntax.phptags.php , >>>everything outside of a pair of opening and closing tags is ignored by the PHP parser. <<< everything outside of the closing tag should be ignored by the parser, and just printed, and further >>>If a file is pure PHP code, it is preferable to omit the PHP closing tag at the end of the file. This prevents accidental whitespace or new lines being added after the PHP closing tag, which may cause unwanted effects because PHP will start output buffering when there is no intention from the programmer to send any output at that point in the script.<<< here it's at least heavily implied that newlines after the end tag will be printed, but this is not actually the case. newlines after the end tags seems to be not printed, almost as if it was part of the end tag. Test script: --------------- <?php $tmp=tmpfile(); fwrite($tmp,"<?php ?>\n"); ob_start(); require(stream_get_meta_data($tmp)['uri']); var_dump(bin2hex(ob_get_clean())); Expected result: ---------------- string(2) "0a" Actual result: -------------- string(0) "" -- Edit bug report at https://bugs.php.net/bug.php?id=76316&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76316&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76316&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76316&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76316&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76316&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76316&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76316&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76316&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76316&r=support Expected behavior: https://bugs.php.net/fix.php?id=76316&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76316&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76316&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76316&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76316&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76316&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76316&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76316&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76316&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76316&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76316&r=mysqlcfg

« previous php.doc.bugs (#15674) next »