[PEAR-BUG] Bug #20482 [Ver->Csd]: Scope indent sniff can get into infinite loop when processing a parse error
[email protected] Mon, 12 Jan 2015 03:37:57 +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 when processing a parse error -Status: Verified +Status: Closed 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: -Status: Verified +Status: Closed I've committed a fix for this issue here: https://github.com/squizlabs/PHP_CodeSniffer/commit/850eb7d82eefb20bbb31e8caea6 8569f4d4d1acf It should stop the scope indent sniff failing for related errors as well. Previous Comments: ------------------------------------------------------------------------ [2015-01-12 03:36:01] squiz -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 ------------------------------------------------------------------------ [2015-01-12 03:35:48] squiz -Summary: PHP_CodeSniffer Won'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