FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: new line in heredoc by jorgsowa · Pull Request #1193 · glayzzle/php-parser · GitHub

fix: new line in heredoc - #1193

Merged
alexander-akait merged 1 commit into
mainfrom
fix/new-line-heredoc
Mar 16, 2026
Merged

fix: new line in heredoc#1193
alexander-akait merged 1 commit into
mainfrom
fix/new-line-heredoc

Conversation

jorgsowa commented Mar 13, 2026
edited
Loading

Copy link
Copy Markdown
Collaborator

Bugs fixed:

  • Escape sequences were ignored in encapsed string parts - in "hello $name\n", the \n after the variable was stored as the literal two characters \ and n instead of a newline. The value field now correctly reflects the runtime value.
  • Trailing newlines were stripped from non-heredoc strings - a cleanup meant only for heredocs (where the final newline before the closing marker is excluded by the PHP spec) was applied to all encapsed strings, silently dropping legitimate trailing newlines from double-quoted and shell strings.
  • Heredoc indentation stripping and escape resolution were applied in wrong order - for heredocs, escape sequences were resolved before indentation was stripped, causing \n escape sequences to be expanded into real newlines
    prematurely, which broke the indentation check and produced incorrect values (e.g. <<<STR\n \na\n STR would raise a false indentation error).
  • " unescaping in double-quoted strings was missing the g flag, so only the first escaped double quote in a string was unescaped.

All changes verified against nikic/php-parser (v5.7.0)

Fixes: #1131

jorgsowa force-pushed the fix/new-line-heredoc branch from 48283de to 7504637 Compare March 13, 2026 00:13
jorgsowa marked this pull request as ready for review March 13, 2026 00:14
jorgsowa force-pushed the fix/new-line-heredoc branch from 7504637 to fb823e7 Compare March 16, 2026 18:07
alexander-akait merged commit 8ab3626 into main Mar 16, 2026
6 checks passed

czosel commented Mar 22, 2026

Copy link
Copy Markdown
Collaborator

Released in v3.5.0 🎉

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

3 participants


Back | FazBrowse Home | New Git URL