On 28.05.2018 at 18:56, Rasmus Schultz wrote:

>>> Yes, this is an expected result under the flexible heredoc RFC. To avoid
>>> issues, please use a heredoc label that does not occur within the string.
>>
>> Hmkay, so code that worked fine with PHP 7.1 and PHP 7.2 breaks with PHP
>> 7.3. This breaking change should at least be prominently documented. As of
>> right now, I do not see such documentation in UPGRADING.
> 
> Wow, I can't believe I didn't think of this when I reviewed that RFC.
> 
> This is potentially a pretty serious BC break, really - at least in two cases:
> 
> 1. Markdown, where indentation can be irregular as well as meaningful.
> 
> 2. Failing tests!
> 
> The latter could prove rather difficult - getting your tests to pass
> under 7.2 and 7.3+ might be far from simple, and at the very least
> would require test-helpers that conditionally treat whitespace
> differently for 7.3+ and earlier versions.
> 
> Even inline HTML could potentially suffer, if you have <pre> blocks.
> 
> And on top of these unexpected results and test-failures, of course
> there may be parse errors for inline content with meaningful
> whitespace that was (or wasn't) indented correctly.
> 
> Honestly, are there any cases where existing code *benefits* from
> changing the existing syntax/feature?

No.

> Some people indent inline blocks so that the output ends up with the
> desired indentation, rather than the source-code looking pretty - in
> those cases, whitespace will now be silently removed and the output no
> longer as desired?

No.

> Are we positive it wouldn't be safer to just introduce a slight syntax
> variation for blocks that treat indentation differently?
> 
> (am I blowing this out of proportion?)
It seems that you have not understood the change.  While formerly the
actual string had exactly the noted whitespace at the beginning of the
lines, now the leading whitespace of the line with the closing marker is
also removed for all other lines (but not additional leading
whitespace).  See the first two examples in the “Closing Marker
Indentation” section[1].

The BC break affects only code which has the heredoc/nowdoc identifier
in the body of the string, namely at the beginning of a line (with
optional leading whitespace).

[1]
<https://wiki.php.net/rfc/flexible_heredoc_nowdoc_syntaxes#closing_marker_indentation>

-- 
Christoph M. Becker

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to