--- C:\Users\Edward\Webs\htmlpurifier\maintenance\PH5P.php 2007-11-04 23:41:49.074543700 -0500 +++ C:\Users\Edward\Webs\htmlpurifier\maintenance/PH5P.new.php 2007-11-05 00:23:52.839543700 -0500 @@ -211,7 +211,10 @@ // If nothing is returned, emit a U+0026 AMPERSAND character token. // Otherwise, emit the character token that was returned. $char = (!$entity) ? '&' : $entity; - $this->emitToken($char); + $this->emitToken(array( + 'type' => self::CHARACTR, + 'data' => $char + )); // Finally, switch to the data state. $this->state = 'data'; @@ -708,7 +711,7 @@ } elseif($char === '&') { /* U+0026 AMPERSAND (&) Switch to the entity in attribute value state. */ - $this->entityInAttributeValueState('non'); + $this->entityInAttributeValueState(); } elseif($char === '>') { /* U+003E GREATER-THAN SIGN (>) @@ -738,7 +741,8 @@ ? '&' : $entity; - $this->emitToken($char); + $last = count($this->token['attr']) - 1; + $this->token['attr'][$last]['value'] .= $char; } private function bogusCommentState() { @@ -1066,6 +1070,11 @@ $this->char++; if(in_array($id, $this->entities)) { + if ($e_name[$c-1] !== ';') { + if ($c < $len && $e_name[$c] == ';') { + $this->char++; // consume extra semicolon + } + } $entity = $id; break; } @@ -3659,7 +3668,7 @@ } } - private function generateImpliedEndTags(array $exclude = array()) { + private function generateImpliedEndTags($exclude = array()) { /* When the steps below require the UA to generate implied end tags, then, if the current node is a dd element, a dt element, an li element, a p element, a td element, a th element, or a tr element, the UA must @@ -3673,7 +3682,8 @@ } } - private function getElementCategory($name) { + private function getElementCategory($node) { + $name = $node->tagName; if(in_array($name, $this->special)) return self::SPECIAL;