Skip to content

Strip heredoc indentation after a lone carriage return - #1189

Open
HawkForge wants to merge 1 commit into
nikic:masterfrom
HawkForge:fix/heredoc-indent-lone-cr
Open

HawkForge wants to merge 1 commit into
nikic:masterfrom
HawkForge:fix/heredoc-indent-lone-cr

Conversation

@HawkForge

Copy link
Copy Markdown

Fixes #1186

ParserAbstract::stripIndentation() only started a new line of a flexible heredoc/nowdoc body after \n. PHP also ends a line at a lone \r, so the indentation was not removed from a line starting after one, and an under-indented such line was not reported.

A line now also starts after a \r that is not followed by \n (no line starts between the \r and \n of \r\n).

Tests: flexibleDocStringCarriageReturn.test (heredoc, nowdoc, interpolated heredoc) and flexibleDocStringCarriageReturnError.test (indentation error). Checked against PHP 8.5 with php -r.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The indentation of a flexible heredoc or nowdoc is not removed from a line that starts after a carriage return

1 participant