php / php/doc-en

Wrong error message regarding HEREDOC indentation level limits

Open
#5,501 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
XML
Stars
596
Forks
890
Avg merge
1d 15h
Merged PRs (30d)
55

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the PHP manual section linked in the issue, especially the HEREDOC subsection and its example output. Trace the reported wording to the PHP source and documentation, then update both so the error text matches the stated indentation rule and verify the example output.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.