Menu

#1 HTML_Safe parse error

Version_1.6.x
open
nobody
5
2007-01-17
2007-01-17
Paradxum
No

Ok... basically the HTML_Safe parser has an error. If you have a tag (let's say Bold) ... and you open and close it .... then when you re-open it... you can never close it except at a forced close point (end of paragraph.)

here's the patch:

--- HTML_Safe.php.old 2007-01-16 18:54:12.000000000 -0600
+++ HTML_Safe.php 2007-01-16 18:54:33.000000000 -0600
@@ -438,7 +438,7 @@ class HTML_Safe
$this->_writeAttrs($attrs);
$this->_xhtml .= '>';
array_push($this->_stack,$name);
- $this->_counter[$name] = isset($this->_counter[$name]) ? $this->_counter[$name]++ : 1;
+ $this->_counter[$name] = isset($this->_counter[$name]) ? ($this->_counter[$name] + 1) : 1;
return true;
}

Discussion

  • Nobody/Anonymous

    Logged In: NO

    Instead off $this->_counter[$name]++ you can write: ++$this->_counter[$name]

     
  • Paradxum

    Paradxum - 2007-10-31

    Logged In: YES
    user_id=596175
    Originator: YES

    You are absolutly correct. However most programmers do not know the difference between pre and post inc so when pre is needed, for clarity I normally do it the long way. :)

     

Log in to post a comment.