mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-12 00:06:27 +00:00
fix displaying unmodified file content in error message(s)
This commit is contained in:
parent
a33ff617d8
commit
989bde3625
@ -105,6 +105,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule
|
|||||||
protected function find($file)
|
protected function find($file)
|
||||||
{
|
{
|
||||||
$content = file_get_contents($file);
|
$content = file_get_contents($file);
|
||||||
|
$origContent = JEDCheckerHelper::splitLines($content);
|
||||||
|
|
||||||
// Exclude comments
|
// Exclude comments
|
||||||
$content = JEDCheckerHelper::cleanPhpCode(
|
$content = JEDCheckerHelper::cleanPhpCode(
|
||||||
@ -120,7 +121,7 @@ class JedcheckerRulesEncoding extends JEDcheckerRule
|
|||||||
if (preg_match($this->encodingsRegex, $line))
|
if (preg_match($this->encodingsRegex, $line))
|
||||||
{
|
{
|
||||||
$found = true;
|
$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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule
|
|||||||
protected function find($file)
|
protected function find($file)
|
||||||
{
|
{
|
||||||
$content = file_get_contents($file);
|
$content = file_get_contents($file);
|
||||||
|
$origContent = JEDCheckerHelper::splitLines($content);
|
||||||
|
|
||||||
// Exclude non-code content
|
// Exclude non-code content
|
||||||
$content = JEDCheckerHelper::cleanPhpCode(
|
$content = JEDCheckerHelper::cleanPhpCode(
|
||||||
@ -121,7 +122,7 @@ class JedcheckerRulesErrorreporting extends JEDcheckerRule
|
|||||||
if (preg_match($this->errorreportingRegex, $line))
|
if (preg_match($this->errorreportingRegex, $line))
|
||||||
{
|
{
|
||||||
$found = true;
|
$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]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -340,6 +340,7 @@ class JedcheckerRulesJamss extends JEDcheckerRule
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$origContent = JEDCheckerHelper::splitLines($content);
|
||||||
$scopes = array(
|
$scopes = array(
|
||||||
'full' => $content,
|
'full' => $content,
|
||||||
'clean' => JEDCheckerHelper::cleanPhpCode($content, JEDCheckerHelper::CLEAN_COMMENTS),
|
'clean' => JEDCheckerHelper::cleanPhpCode($content, JEDCheckerHelper::CLEAN_COMMENTS),
|
||||||
@ -403,8 +404,8 @@ class JedcheckerRulesJamss extends JEDcheckerRule
|
|||||||
$end = strlen($scoped_content);
|
$end = strlen($scoped_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$first_code = substr($scoped_content, $start, min($end - $start, 200));
|
|
||||||
$first_line = $this->calculate_line_number($offset, $scoped_content);
|
$first_line = $this->calculate_line_number($offset, $scoped_content);
|
||||||
|
$first_code = $origContent[$first_line - 1];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user