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

Bug #19782 Invalid found size functions in loop when using object operator
Submitted: 2013-01-11 22:33 UTC
From: dioubernardo Assigned: squiz
Status: Closed Package: PHP_CodeSniffer (version 1.4.3)
PHP Version: 5.3.6 OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2013-01-11 22:33 UTC] dioubernardo (Bernardo Silva)
Description: ------------ The use of the word "count" generates an error Squiz.PHP.DisallowSizeFunctionsInLoops.Found The use of count() inside a loop condition is not allowed; assign the return value to a variable and use the variable in the loop condition instead Test script: --------------- <?php $a = new stdClass(); $a->count = 5; do { echo $a->count; $a->count--; } while($a->count); ?>

Comments

 [2013-01-14 02:10 UTC] squiz (Greg Sherwood)
-Summary: Invalid found size functions in loop +Summary: Invalid found size functions in loop when using object operator -Assigned To: +Assigned To: squiz
 [2013-01-14 02:11 UTC] squiz (Greg Sherwood)
-Status: Assigned +Status: Closed
Fix committed to github repo: https://github.com/squizlabs/PHP_CodeSniffer/commit/42a568db42cf6e85e49c7e8e97 2e460b44f1f121