From 3271601225d091c6f89d66653ac3bec9973c380d Mon Sep 17 00:00:00 2001 From: Peter van Westen Date: Mon, 4 Nov 2013 15:22:53 +0100 Subject: [PATCH] Fixed unnecessary checks in php files with no code (2) This fix makes the JEXEC check not give false negatives on placeholder files. So php files with only a comment tag in it. These don't need GPL info. --- .../com_jedchecker/libraries/rules/jexec.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/source/administrator/components/com_jedchecker/libraries/rules/jexec.php b/source/administrator/components/com_jedchecker/libraries/rules/jexec.php index 7b3ceff..ff2b70a 100644 --- a/source/administrator/components/com_jedchecker/libraries/rules/jexec.php +++ b/source/administrator/components/com_jedchecker/libraries/rules/jexec.php @@ -78,8 +78,22 @@ class jedcheckerRulesJexec extends JEDcheckerRule $defines = $this->params->get('constants'); $defines = explode(',', $defines); + $hascode = 0; + foreach ($content AS $line) { + $tline = trim($line); + + if ($tline == '' || $tline == '') + { + continue; + } + + if ($tline['0'] != '/' && $tline['0'] != '*') + { + $hascode = 1; + } + // Search for "defined" $pos_1 = stripos($line, 'defined'); @@ -116,6 +130,6 @@ class jedcheckerRulesJexec extends JEDcheckerRule unset($content); - return false; + return $hascode ? false : true; } }