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)
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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bugs fixed:
prematurely, which broke the indentation check and produced incorrect values (e.g. <<<STR\n \na\n STR would raise a false indentation error).
All changes verified against nikic/php-parser (v5.7.0)
Fixes: #1131