1 (edited by lriggle 2012-09-26 18:06:26)

Topic: Quick question about code in hl_bal() - Am I seeing this wrong?

Hi Guys!

I noticed something and I wanted to run it by the people here to make sure I'm not misunderstanding something.

Line 193 & 194 of htmLawed.php references a variable named $e, but as far as I can tell, that variable is not instantiated within that function until line 209. Am I missing something? Or is there somewhere else that it can be instantiated?

192: // bad tags, & ele content
193: if(isset($e) && ($do == 1 or (isset($ok['#pcdata']) && ($do == 3 or $do == 5)))){
194:  echo '<', $s, $e, $a, '>';
195: }

...

209: $s = null; $e = null; $a = null; $x = null; list($all, $s, $e, $a, $x) = $r;

This looks like it's been in there for a while (at least as long as I've been following the project, so a few months), so it's entirely possible I missed something.

Thanks!

2

Re: Quick question about code in hl_bal() - Am I seeing this wrong?

The block of code you refer to is in a 'for' loop. The value of '$e' established in an iteration of the loop (at line 209) is used in the next iteration (at line 194). Besides another purpose, the 'isset($e)' ensures that there is no error during the very first iteration of the loop when '$e' is yet to be instantiated.