Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.4.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)    
Subscription  


 [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.

Comments

 [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 pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.