From 4ce3deba26f22917530ba099e226342e86ee5a71 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 15 May 2008 04:32:05 +0000 Subject: [PATCH] [2.1.4] [MFH] Recursive auto-close with
from r1492 git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/branches/php4@1713 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 2 ++ library/HTMLPurifier/Strategy/MakeWellFormed.php | 5 ++--- tests/HTMLPurifier/Strategy/MakeWellFormedTest.php | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 88793641..57a3511e 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier ! CSS properties are now case-insensitive - Colors missing # but in hex form will be corrected - CSS Number algorithm improved +- Autoclose now operates iteratively, i.e.
now has + both span tags closed. 2.1.3, released 2007-11-05 ! tests/multitest.php allows you to test multiple versions by running diff --git a/library/HTMLPurifier/Strategy/MakeWellFormed.php b/library/HTMLPurifier/Strategy/MakeWellFormed.php index 4b6f498f..30208ba1 100644 --- a/library/HTMLPurifier/Strategy/MakeWellFormed.php +++ b/library/HTMLPurifier/Strategy/MakeWellFormed.php @@ -158,10 +158,9 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy // the parent if (!isset($parent_info->child->elements[$token->name])) { if ($e) $e->send(E_NOTICE, 'Strategy_MakeWellFormed: Tag auto closed', $parent); - // close the parent, then append the token + // close the parent, then re-loop to reprocess token $result[] = new HTMLPurifier_Token_End($parent->name); - $result[] = $token; - $this->currentNesting[] = $token; + $this->inputIndex--; continue; } diff --git a/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php b/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php index a227d6a7..4f5df04e 100644 --- a/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php +++ b/tests/HTMLPurifier/Strategy/MakeWellFormedTest.php @@ -82,5 +82,12 @@ class HTMLPurifier_Strategy_MakeWellFormedTest extends HTMLPurifier_StrategyHarn ); } + function testAutoCloseMultiple() { + $this->assertResult( + '
', + '
' + ); + } + }