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

From: Date: Thu, 07 Sep 2017 15:34:38 +0000
Subject: Re: Consider only ignoring newlines for final ?> in a file
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-100449@lists.php.net to get a copy of this message
On Thu, Sep 7, 2017 at 10:23 AM, Andrea Faulds <ajf@ajf.me> wrote: > What I want to change is how it behaves in other circumstances, i.e. > templating. > > Thanks. > > I get that, but I can think of one example where this innocent change might BC break something. You cite this change being for templating - this implies the php files with this feature are being loaded by another php file with require() or include(). 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.

« previous php.internals (#100449) next »