Forráskód Böngészése

[Zend_Markup] Added a unit test for a fatal parser error, and corrected the error.

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@19901 44c647ce-9c0f-0410-b52a-842ac1e357ba
kokx 16 éve
szülő
commit
3179a502ae

+ 2 - 1
library/Zend/Markup/Parser/Bbcode.php

@@ -435,9 +435,10 @@ class Zend_Markup_Parser_Bbcode implements Zend_Markup_Parser_ParserInterface
         if ($this->_isStopper($this->_tag)) {
             // we got a stopper, end the current tag and get back to the parent
             $this->_current->setStopper($this->_tag);
-            $this->_current = $this->_current->getParent();
 
             $this->_removeFromSearchedStoppers($this->_current);
+
+            $this->_current = $this->_current->getParent();
         } elseif (!empty($this->_searchedStoppers[$this->_tag])) {
             // hell has broken loose, these stoppers are searched somewere
             // lower in the tree

+ 16 - 0
tests/Zend/Markup/BbcodeAndHtmlTest.php

@@ -342,6 +342,22 @@ class Zend_Markup_BbcodeAndHtmlTest extends PHPUnit_Framework_TestCase
                             $m->render('[b class=\'">xss\']foobar[/b]'));
     }
 
+    public function testWrongNestedLists()
+    {
+        $m = $this->_markup;
+        // thanks to PadraicB for finding this
+        $input = <<<BBCODE
+[list]
+[*] Subject 1
+[list]
+[*] First
+[*] Second
+[/list]
+[*] Subject 2
+[/list]
+BBCODE;
+        $m->render($input);
+    }
 }