Re: Consider only ignoring newlines for final ?> in a file

From: Date: Thu, 07 Sep 2017 16:51:14 +0000
Subject: Re: Consider only ignoring newlines for final ?> in a file
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-100450@lists.php.net to get a copy of this message
On 7 September 2017 16:34:38 BST, Michael Morris <tendoaki@gmail.com> wrote: > Suppose someone creates a template >wrapper with this circumstance in mind. Instead of doing the obvious, >omit >the final ?> tag in the template, they write code in the template >wrapper >to snip the last endline character from the included file. Depending on >how >their code is written your change could now become a breaking change: >for >example they just lop off the last character of the template's return >without checking to see if it is indeed a newline character. I think you have the change the wrong way round (unless I do). The current behaviour is: - PHP blocks at end of file -> suppress following newline - PHP blocks elsewhere in file -> suppress following newline The proposed behaviour is: - PHP blocks at end of file -> suppress following newline (no change) - PHP blocks elsewhere in file -> treat following newline literally So in your scenario, there would be no newline to trim, before or after the proposed change. Regards, -- Rowan Collins [IMSoP]

« previous php.internals (#100450) next »