Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.7.2

Bug #8834 Massive memory consumption
Submitted: 2006-10-03 09:33 UTC
From: hholzgra Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version CVS)
PHP Version: 5.2.0 RC4 OS: linux
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 35 + 28 = ?

 [2006-10-03 09:33 UTC] hholzgra (Hartmut Holzgraefe)
Description: ------------ When using phpcs on my CodeGen_PECL/PECL/Element/Function.php the process is finaly terminated by an OOM kill after consuming about 2GB of memory. Test script: --------------- phpcs pear/CodeGen_PECL/PECL/Element/Function.php Expected result: ---------------- Results within a minute or less as with other PHP source files of similar size. Actual result: -------------- After running for ~30sec the phpcs process suddenly starts to allocate memory at a rate of about 10MB per second until the system finally runs out of memory.


 [2006-10-03 10:23 UTC] squiz at php dot net (Greg Sherwood)
Can reproduce with this code: ------------ <?php foreach ($elements as $element) { switch ($element) { case "case_one": // Do something. } if ($something) { // Do IF. } else if ($somethingElse) { // Do ELSE. } } ?>
 [2006-10-03 10:30 UTC] squiz at php dot net (Greg Sherwood)
Actually, you dont need the SWITCH. The problem is the ELSE IF. The ScopeIndent sniff sees the ELSE as a scope opener and tries to jump to the next semicolon, which doesn't exist , so the end of file is reached but the sniff just keeps going forever. ------------ <?php foreach ($elements as $element) { if ($something) { // Do IF. } else if ($somethingElse) { // Do ELSE. } } ?>
 [2006-10-03 11:07 UTC] squiz at php dot net (Greg Sherwood)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.