From 69b298c4b55d3201ca1c76bb16933cef929dd1ca Mon Sep 17 00:00:00 2001 From: nikic Date: Tue, 18 Oct 2011 18:03:28 +0200 Subject: [PATCH] Recognize halt_compiler() ?> (without ;) --- lib/PHPParser/Lexer.php | 2 +- test/PHPParser/Tests/LexerTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/PHPParser/Lexer.php b/lib/PHPParser/Lexer.php index 23e9498..91cd94d 100644 --- a/lib/PHPParser/Lexer.php +++ b/lib/PHPParser/Lexer.php @@ -117,7 +117,7 @@ class PHPParser_Lexer // ensure that it is followed by (); // this simplifies the situation, by not allowing any comments // in between of the tokens. - if (!preg_match('~\s*\(\s*\)\s*;~', $textAfter, $matches)) { + if (!preg_match('~\s*\(\s*\)\s*(?:;|\?>)~', $textAfter, $matches)) { throw new PHPParser_Error('__halt_compiler must be followed by "();"'); } diff --git a/test/PHPParser/Tests/LexerTest.php b/test/PHPParser/Tests/LexerTest.php index 881de37..2b9f171 100644 --- a/test/PHPParser/Tests/LexerTest.php +++ b/test/PHPParser/Tests/LexerTest.php @@ -87,6 +87,7 @@ class PHPParser_Tests_LexerTest extends PHPUnit_Framework_TestCase return array( array('Remaining Text', 'Remaining Text'), //array('