From 6f36a88993a07d0ccd52d813ceff27de022429c3 Mon Sep 17 00:00:00 2001 From: Arne Blankerts Date: Wed, 22 Jan 2014 00:48:27 +0100 Subject: [PATCH] Ensure no registered error handler will see the 'reset' error --- lib/PHPParser/Lexer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/PHPParser/Lexer.php b/lib/PHPParser/Lexer.php index 0ca5d49..b4202fc 100644 --- a/lib/PHPParser/Lexer.php +++ b/lib/PHPParser/Lexer.php @@ -40,10 +40,14 @@ class PHPParser_Lexer } protected function resetErrors() { - // clear error_get_last() by forcing an undefined variable error + // set error_get_last() to defined state by forcing an undefined variable error + set_error_handler(array($this, 'dummyErrorHandler'), 0); @$undefinedVariable; + restore_error_handler(); } + private function dummyErrorHandler() { return false; } + protected function handleErrors() { $error = error_get_last();