From 57f897661e4cbb9ba421c594e5de3c182da98fc6 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Thu, 10 Jan 2008 21:40:41 +0000 Subject: [PATCH] [3.1.0] [BACKPORT] Fix
by sending back to the front of the loop for reprocessing. git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1492 48356398-32a2-884e-a903-53898d9a118a --- NEWS | 4 ++++ library/HTMLPurifier/Strategy/MakeWellFormed.php | 5 ++--- tests/HTMLPurifier/Strategy/MakeWellFormedTest.php | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 0ff188c4..8996283f 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,10 @@ NEWS ( CHANGELOG and HISTORY ) HTMLPurifier . Internal change ========================== +3.0.1, unknown release date +- Autoclose now operates iteratively, i.e.
now has + both span tags closed. + 3.0.0, released 2008-01-06 # HTML Purifier is PHP 5 only! The 2.1.x branch will be maintained until PHP 4 is completely deprecated, but no new features will be added diff --git a/library/HTMLPurifier/Strategy/MakeWellFormed.php b/library/HTMLPurifier/Strategy/MakeWellFormed.php index 81ad42e6..438d3f0f 100644 --- a/library/HTMLPurifier/Strategy/MakeWellFormed.php +++ b/library/HTMLPurifier/Strategy/MakeWellFormed.php @@ -156,10 +156,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( + '
', + '
' + ); + } + }