mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-16 01:57:14 +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);
|
$code = substr($content, 0, $pos);
|
||||||
$cleanContent = $isCleanHtml ? self::removeContent($code) : $code;
|
$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];
|
$foundPos = $match[0][1];
|
||||||
$cleanContent .= substr($content, $pos, $foundPos - $pos);
|
$cleanContent .= substr($content, $pos, $foundPos - $pos);
|
||||||
@ -210,7 +210,14 @@ abstract class JEDCheckerHelper
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '//':
|
case '//':
|
||||||
|
case '#':
|
||||||
$commentLen = strcspn($content, "\r\n", $pos);
|
$commentLen = strcspn($content, "\r\n", $pos);
|
||||||
|
$endPhpPos = strpos($content, '?>', $pos);
|
||||||
|
|
||||||
|
if ($endPhpPos !== false && $endPhpPos < $pos + $commentLen)
|
||||||
|
{
|
||||||
|
$commentLen = $endPhpPos - $pos;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$isCleanComments)
|
if (!$isCleanComments)
|
||||||
{
|
{
|
||||||
@ -218,6 +225,7 @@ abstract class JEDCheckerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pos += $commentLen;
|
$pos += $commentLen;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '?>':
|
case '?>':
|
||||||
|
Loading…
Reference in New Issue
Block a user