Doug,

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.

regards,

massa

CommentFileSizeAuthor
#4 coder.png181.97 KBbrmassa
#3 158456.jpg149.9 KBdouggreen

Comments

douggreen’s picture

Please give me a better example, such as an existing contrib module to test with or a code snippet that triggers the error. Thanks!

brmassa’s picture

Doug,

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

douggreen’s picture

StatusFileSize
new149.9 KB

I don't see the problem. See attached screenshot. Please attach a screenshot.

brmassa’s picture

Status: Active » Needs review
StatusFileSize
new181.97 KB

Doug,

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().

regards,

massa

douggreen’s picture

Status: Needs review » Fixed

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.

Anonymous’s picture

Status: Fixed » Closed (fixed)