mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-30 16:53:59 +00:00
fix processing of one-line comments
This commit is contained in:
parent
d1a1bfd10b
commit
cbd3bd8f9e
@ -169,7 +169,7 @@ abstract class JEDCheckerHelper
|
||||
$code = substr($content, 0, $pos);
|
||||
$cleanContent = $isCleanHtml ? self::removeContent($code) : $code;
|
||||
|
||||
while (preg_match('/(?:[\'"]|\/\*|\/\/|\?>)/', $content, $match, PREG_OFFSET_CAPTURE, $pos))
|
||||
while (preg_match('/(?:[\'"]|\/\*|\/\/|#|\?>)/', $content, $match, PREG_OFFSET_CAPTURE, $pos))
|
||||
{
|
||||
$foundPos = $match[0][1];
|
||||
$cleanContent .= substr($content, $pos, $foundPos - $pos);
|
||||
@ -210,7 +210,14 @@ abstract class JEDCheckerHelper
|
||||
break;
|
||||
|
||||
case '//':
|
||||
case '#':
|
||||
$commentLen = strcspn($content, "\r\n", $pos);
|
||||
$endPhpPos = strpos($content, '?>', $pos);
|
||||
|
||||
if ($endPhpPos !== false && $endPhpPos < $pos + $commentLen)
|
||||
{
|
||||
$commentLen = $endPhpPos - $pos;
|
||||
}
|
||||
|
||||
if (!$isCleanComments)
|
||||
{
|
||||
@ -218,6 +225,7 @@ abstract class JEDCheckerHelper
|
||||
}
|
||||
|
||||
$pos += $commentLen;
|
||||
|
||||
break;
|
||||
|
||||
case '?>':
|
||||
|
Loading…
Reference in New Issue
Block a user