Skip to content

Wrong error message regarding HEREDOC indentation level limits #5501

@dan-software-engineer

Description

@dan-software-engineer

the error message regarding HEREDOC indentation limit has logically incorrect text.

steps to reproduce:

  1. navigate to https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  2. find the sub-section titled "Closing identifier must not be indented further than any lines of the body"
  3. find the output of the code from that example - "Parse error: Invalid body indentation level (expecting an indentation level of at least 3) in example.php on line 4"

issue: the error message says that the indentation level must be AT LEAST 3, i.e. "indentation level >= 3".
this contradicts and is completely opposite to the PHP rule (mentioned in the code example title) "Closing identifier must NOT be indented further than any lines of the body"; in this example - "indentation level <= 3".
the code example title contains the correct PHP rule - that the indentation of the closing identifier must NOT be greater than the maximum indentation of the string body.
the error messages from the exception contains wrong and opposite wording.
this error message needs to be fixed both in PHP source-code and in the documentation on that page.

thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions