33
2
mirror of https://github.com/joomla-extensions/jedchecker.git synced 2024-11-05 21:07:57 +00:00

False positive in Rule Framework - Joomla framework deprecated and unsafe

This commit is contained in:
Demis Palma 2016-05-25 12:02:27 +01:00
parent 0a3b040cfb
commit 060faec757

View File

@ -132,9 +132,12 @@ class JedcheckerRulesFramework extends JEDcheckerRule
{
foreach ($testObject->tests AS $singleTest)
{
if (stripos($line, $singleTest) !== false)
// Detect the $singleTest string, but only if it's not between single or double-quotes
// This is to avoid false positive such as JText::_('JERROR_ALERTNOAUTHOR') which matched JError
$regex = "/'[^']+'(*SKIP)(*F)|\"[^']+\"(*SKIP)(*F)|" . $singleTest . "/";
if (preg_match($regex, $line) !== 0)
{
$line = str_ireplace($singleTest, '<b>' . $singleTest . '</b>', $line);
$line = preg_replace($regex, '<b>' . $singleTest . '</b>', $line);
$error_message = JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_' . strtoupper($testObject->group)) . ':<pre>' . $line . '</pre>';
switch ($testObject->kind)