mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-29 04:42:36 +00:00
Merge pull request #186 from dryabov/patch-62
Fix displaying unmodified file content in error message(s)
This commit is contained in:
commit
bcc8f69bb5
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Joomla.JEDChecker
|
||||
*
|
||||
* @copyright Copyright (C) 2017 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @copyright Copyright (C) 2017 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* Copyright (C) 2008 - 2016 compojoom.com . All rights reserved.
|
||||
* @author Daniel Dimitrov <daniel@compojoom.com>
|
||||
* 02.06.12
|
||||
@ -105,6 +105,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule
|
||||
protected function find($file)
|
||||
{
|
||||
$content = file_get_contents($file);
|
||||
$origContent = JEDCheckerHelper::splitLines($content);
|
||||
|
||||
// Exclude comments
|
||||
$content = JEDCheckerHelper::cleanPhpCode(
|
||||
@ -120,7 +121,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule
|
||||
if (preg_match($this->encodingsRegex, $line))
|
||||
{
|
||||
$found = true;
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ENCODING'), $i + 1, $line);
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ENCODING'), $i + 1, $origContent[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Joomla.JEDChecker
|
||||
*
|
||||
* @copyright Copyright (C) 2017 - 2019 Open Source Matters, Inc. All rights reserved.
|
||||
* @copyright Copyright (C) 2017 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* Copyright (C) 2008 - 2016 mijosoft.com . All rights reserved.
|
||||
* @author Denis Dulici <denis@mijosoft.com>
|
||||
*
|
||||
@ -106,6 +106,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule
|
||||
protected function find($file)
|
||||
{
|
||||
$content = file_get_contents($file);
|
||||
$origContent = JEDCheckerHelper::splitLines($content);
|
||||
|
||||
// Exclude non-code content
|
||||
$content = JEDCheckerHelper::cleanPhpCode(
|
||||
@ -121,7 +122,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule
|
||||
if (preg_match($this->errorreportingRegex, $line))
|
||||
{
|
||||
$found = true;
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ERRORREPORTING'), $i + 1, $line);
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_ERROR_ERRORREPORTING'), $i + 1, $origContent[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* @package Joomla.JEDChecker
|
||||
*
|
||||
* @copyright Copyright (C) 2017 - 2021 Open Source Matters, Inc. All rights reserved.
|
||||
* @copyright Copyright (C) 2017 - 2022 Open Source Matters, Inc. All rights reserved.
|
||||
* Copyright (C) 2008 - 2016 fasterjoomla.com. All rights reserved.
|
||||
* @author Riccardo Zorn <support@fasterjoomla.com>
|
||||
* Bernard Toplak <bernard@orion-web.hr>
|
||||
@ -340,6 +340,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule
|
||||
}
|
||||
else
|
||||
{
|
||||
$origContent = JEDCheckerHelper::splitLines($content);
|
||||
$scopes = array(
|
||||
'full' => $content,
|
||||
'clean' => JEDCheckerHelper::cleanPhpCode($content, JEDCheckerHelper::CLEAN_COMMENTS),
|
||||
@ -403,8 +404,8 @@ class JedcheckerRulesJamss extends JEDcheckerRule
|
||||
$end = strlen($scoped_content);
|
||||
}
|
||||
|
||||
$first_code = substr($scoped_content, $start, min($end - $start, 200));
|
||||
$first_line = $this->calculate_line_number($offset, $scoped_content);
|
||||
$first_code = $origContent[$first_line - 1];
|
||||
break;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user