From d5873b177b80ef292e4d10eb51449a3f411d93c0 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Sun, 26 Feb 2017 23:44:28 +0100 Subject: [PATCH] Adjust the end attributes on the stack as well --- lib/PhpParser/ParserAbstract.php | 1 + test/code/parser/errorHandling/recovery.test | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PhpParser/ParserAbstract.php b/lib/PhpParser/ParserAbstract.php index e934463..7c7916e 100644 --- a/lib/PhpParser/ParserAbstract.php +++ b/lib/PhpParser/ParserAbstract.php @@ -318,6 +318,7 @@ abstract class ParserAbstract implements Parser // We treat the error symbol as being empty, so we reset the end attributes // to the end attributes of the last non-error symbol + $this->endAttributeStack[$this->stackPos] = $this->endAttributeStack[$this->stackPos - 1]; $this->endAttributes = $this->endAttributeStack[$this->stackPos - 1]; break; diff --git a/test/code/parser/errorHandling/recovery.test b/test/code/parser/errorHandling/recovery.test index b1fd129..a2cf467 100644 --- a/test/code/parser/errorHandling/recovery.test +++ b/test/code/parser/errorHandling/recovery.test @@ -857,7 +857,7 @@ array( 0: Bar ) ) - name: Expr_Error[3:10 - 3:10]( + name: Expr_Error[3:10 - 3:9]( ) ) byRef: false