From 9fba1df4e0ebb0f0f1ab19417594c471cf9b556b Mon Sep 17 00:00:00 2001 From: nikic Date: Wed, 19 Oct 2011 18:09:13 +0200 Subject: [PATCH] Circumvent token_get_all bug with b"$var" --- lib/PHPParser/Lexer.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/PHPParser/Lexer.php b/lib/PHPParser/Lexer.php index 91cd94d..5684e29 100644 --- a/lib/PHPParser/Lexer.php +++ b/lib/PHPParser/Lexer.php @@ -76,9 +76,16 @@ class PHPParser_Lexer $token = $this->tokens[$this->pos]; if (is_string($token)) { - $value = $token; - $line = $this->line; - return ord($token); + $line = $this->line; + + // bug in token_get_all + if ('b"' === $token) { + $value = 'b"'; + return ord('"'); + } else { + $value = $token; + return ord($token); + } } else { $this->line += substr_count($token[1], "\n");