33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-15 17:47:11 +00:00

don't search for JEXEC guard in comments

This commit is contained in:
Denis Ryabov 2021-02-23 22:20:25 +03:00
parent 21faa210dc
commit 0a09a14fb3

View File

@ -77,7 +77,16 @@ class JedcheckerRulesJexec extends JEDcheckerRule
*/ */
protected function find($file) protected function find($file)
{ {
$content = (array) file($file); // load file and strip comments
$content = php_strip_whitespace($file);
// skip empty files
if ($content === '' || preg_match('#^<\?php\s+$#', $content))
{
return true;
}
$content = preg_split('/(?:\r\n|\n|\r)(?!$)/', $content);
// Get the constants to look for // Get the constants to look for
$defines = $this->params->get('constants'); $defines = $this->params->get('constants');