From cd26cee521bfd1df66542aa2928bdb48916f0b21 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 22 Aug 2011 15:49:11 +0200 Subject: [PATCH] Issue #619880 by ao2: don't parse non-php files. X-Face: z*RaLf`X<@C75u6Ig9}{oW$H;1_\2t5)({*|jhM/Vb;]yA5\I~93>J<_`<4)A{':UrE This avoids PHP checks in non-php files, like .info files. --- coder.module | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/coder.module b/coder.module index 2de6117..9a91601 100644 --- a/coder.module +++ b/coder.module @@ -1086,21 +1086,29 @@ function _coder_read_and_parse_file(&$coder_args) { $regex = '/('. implode('|', array_merge(array('module'), $coder_args['#php_extensions'])) .')$/'; if (!preg_match($regex, $coder_args['#filename'])) { $is_php_file = 0; - /* + // If this isn't a php file, then don't try to parse it. if ((($filepath = realpath($coder_args['#filename'])) && file_exists($filepath))) { - $full_lines = file($filepath); - if ($full_lines[0] != ' $line) { + $lines = file($filepath); + if ($lines[0] != ' $line) { if (($line = trim($line, "\r\n")) != '') { - $all_lines[$lineno] = $line; + $full_lines[$lineno] = $line; + $all_lines[$lineno] = array($line); } } - $coder_args['#all_lines'] = $all_lines; + // Add the files lines to the arguments. + $coder_args['#all_array_lines'] = $all_lines; + $coder_args['#php_array_lines'] = array(); + $coder_args['#allphp_array_lines'] = array(); + $coder_args['#html_array_lines'] = array(); + $coder_args['#quote_array_lines'] = array(); + $coder_args['#doublequote_array_lines'] = array(); + $coder_args['#comment_array_lines'] = array(); + $coder_args['#all_lines'] = $full_lines; return 1; } } - */ } // Get the path to the module file. -- 1.7.5.4