From dd214f34513092414b034b4d021f39283bb15c19 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Thu, 28 Feb 2008 18:56:58 +0000 Subject: [PATCH] Simple, but significant improvement to the parser for accurate function call catching. Removed unused code from output modules. Mantis: 2691 git-svn-id: file:///srv/svn/scanner/trunk@12 a0501263-5b7a-4423-a8ba-1edf086583e7 --- modules/output_html.php | 1 - modules/output_text.php | 1 - parser.php | 7 +++++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/output_html.php b/modules/output_html.php index 6a87cb5..fe703cf 100644 --- a/modules/output_html.php +++ b/modules/output_html.php @@ -65,7 +65,6 @@ class HTMLOutput extends OutputModule { ); $current_file = ''; foreach( $faults as $id => $fault ) { - $svn = serialize( $fault['svn'] ); if( $current_file != $fault['object']['file'] ) { if( $current_file != '' ) { fwrite( $output, '' ); diff --git a/modules/output_text.php b/modules/output_text.php index 96666e1..0bb4525 100644 --- a/modules/output_text.php +++ b/modules/output_text.php @@ -8,7 +8,6 @@ class TextOutput extends OutputModule { return false; } foreach( $faults as $fault ) { - $svn = serialize( $fault['svn'] ); fprintf( $output, "%s\t%d\t%s\t%d\t%s\t%d\t%s\n", $fault['module'], $fault['level'], diff --git a/parser.php b/parser.php index 7983eb5..486ae53 100644 --- a/parser.php +++ b/parser.php @@ -155,6 +155,13 @@ class PHPParser { ) ); } break; + default: + /* Should be able to add a hook here later on to catch the use of defines, + which are basically just T_STRINGs that PHP can't find anything else to + do with. That could be useful in determining whether a define is defined. + */ + $string = null; + break; } if( !in_array( $token, array( '(', ')' ) ) ) { $last_token = null; } if( (bool)($this->fetch_mode & PHPPARSER_FETCH_EXPRESSIONS) && in_array( $token, array( '{', '}', ';', '=', '?', ':' ) ) && strlen( trim( $expression ) ) > 0 ) {