When there are count() or sizeof() problems. some opened HTML tag makes the rest of the pages turns green. verify if there isnt a missing HTML tag to close.
im using this module mainly against EC 5-4. here are the steps:
1* enable performance tips
2* if you check a module that has the count() or sizeof() functions, it will "bip"! You can use Ecommerce 3.1 (the current version). Check the Cart module. it has some count().
3* the hint starts ok, marking count() or sizeof() in red. But when you recommend !empty(), it starts to get green and doenst stop. all line and sometime all page gets green.
hi there! i found the bug. on coder_performance.inc
function _coder_performance_empty_warning() {
return t('if (count($foo)) and if (sizeof($foo)) are much slower than if (<code class="good">!empty($foo)</code)');
}
see, the final code tag is not closed. its curious how Firefox ignore it! the browser i use, Konqueror (the original base for Safari) is much more compliant to standards, so it prints correcly wrong.
One more thing: if you see the screenshot, despite the help saying only about the count() inside a IF(), the code found a normal count() function, normally used and no change for optimization. it was not inside a if().
Thanks. BTW, I've removed the performance review from the 6.x release because, the things it finds were submitted by sun, and the community never really agreed that these were good things to fix. I'd be skeptical of what it finds. It should also probably be removed from the 5.x release until we have a better discussion about them... But thanks for tracking down the problem.
Comments
Comment #1
douggreen commentedPlease give me a better example, such as an existing contrib module to test with or a code snippet that triggers the error. Thanks!
Comment #2
brmassa commentedDoug,
im using this module mainly against EC 5-4. here are the steps:
1* enable performance tips
2* if you check a module that has the count() or sizeof() functions, it will "bip"! You can use Ecommerce 3.1 (the current version). Check the Cart module. it has some count().
3* the hint starts ok, marking count() or sizeof() in red. But when you recommend !empty(), it starts to get green and doenst stop. all line and sometime all page gets green.
cheers,
massa
Comment #3
douggreen commentedI don't see the problem. See attached screenshot. Please attach a screenshot.
Comment #4
brmassa commentedDoug,
hi there! i found the bug. on coder_performance.inc
see, the final code tag is not closed. its curious how Firefox ignore it! the browser i use, Konqueror (the original base for Safari) is much more compliant to standards, so it prints correcly wrong.
One more thing: if you see the screenshot, despite the help saying only about the count() inside a IF(), the code found a normal count() function, normally used and no change for optimization. it was not inside a if().
regards,
massa
Comment #5
douggreen commentedThanks. BTW, I've removed the performance review from the 6.x release because, the things it finds were submitted by sun, and the community never really agreed that these were good things to fix. I'd be skeptical of what it finds. It should also probably be removed from the 5.x release until we have a better discussion about them... But thanks for tracking down the problem.
Comment #6
(not verified) commented