diff --git a/source/administrator/components/com_jedchecker/libraries/rules/framework.php b/source/administrator/components/com_jedchecker/libraries/rules/framework.php index 870c8a6..31dd47c 100755 --- a/source/administrator/components/com_jedchecker/libraries/rules/framework.php +++ b/source/administrator/components/com_jedchecker/libraries/rules/framework.php @@ -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, '' . $singleTest . '', $line); + $line = preg_replace($regex, '' . $singleTest . '', $line); $error_message = JText::_('COM_JEDCHECKER_ERROR_FRAMEWORK_' . strtoupper($testObject->group)) . ':
' . $line . ''; switch ($testObject->kind)