[PEAR-BUG] Bug #20482 [Ver]: Scope indent sniff can get into infinite loop when processing a parse error

[email protected] Mon, 12 Jan 2015 03:36:01 +0000 (GMT)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at https://pear.php.net/bugs/bug.php?id=20482&edit=1

 ID:               20482
 Updated by:       [email protected]
 Reported By:      susah dot yak at gmail dot com
-Summary:          Scope indent sniff can get into infinite loop due wen
                    processing parse error
+Summary:          Scope indent sniff can get into infinite loop when
                    processing a parse error
 Status:           Verified
 Type:             Bug
 Package:          PHP_CodeSniffer
 Operating System: Windows 8.1
 Package Version:  2.1.0
 PHP Version:      5.6.4
 Assigned To:      squiz
 Roadmap Versions: 
 New Comment:

-Summary: Scope indent sniff can get into infinite loop due wen
          processing parse error
+Summary: Scope indent sniff can get into infinite loop when
          processing a parse error



Previous Comments:
------------------------------------------------------------------------

[2015-01-12 03:35:48] squiz

-Summary: PHP_CodeSniffer Won&#039;t Analyze and High CPU Usage
+Summary: Scope indent sniff can get into infinite loop due wen
          processing parse error


------------------------------------------------------------------------

[2015-01-12 03:22:42] squiz

-Status:      Open
+Status:      Verified
-Assigned To:
+Assigned To: squiz
The Generic.WhiteSpace.ScopeIndent sniff seems to be getting caught out
by that parse 
errors. I'll take a look into it now.

------------------------------------------------------------------------

[2015-01-11 20:35:26] sourc7

Description:
------------
Hi, I'm upgrading PHP_CodeSniffer from 1.5.6 to 2.1.0 (latest) but when
I analyze php file containing echo "". It's not output the result but
just waiting with high cpu usage.

But after I removing the PHP_CodeSniffer 2.10 then Re-installing the
1.5.6 the problem is solved

Test script:
---------------
<?php

echo ""

Expected result:
----------------
FOUND 2 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------

 1 | ERROR | End of line character is invalid; expected "\n" but found
"\r\n"
 2 | ERROR | Missing file doc comment
--------------------------------------------------------------------------------

UPGRADE TO PHP_CODESNIFFER 2.0 TO FIX ERRORS AUTOMATICALLY
--------------------------------------------------------------------------------

Actual result:
--------------
None with High CPU usage

------------------------------------------------------------------------


-- 
Edit this bug report at https://pear.php.net/bugs/bug.php?id=20482&edit=1