Resetting internal states and avoid memory issues
authorAlexander Ebert <ebert@woltlab.com>
Sun, 6 Nov 2016 08:51:29 +0000 (09:51 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 6 Nov 2016 08:51:29 +0000 (09:51 +0100)
wcfsetup/install/files/lib/system/html/input/HtmlInputProcessor.class.php

index 2daf141d14af59c555128ad3996b2df6227c20c5..10719fbbc7cf70c13fd5f8ef290900dae8cf8059 100644 (file)
@@ -42,6 +42,8 @@ class HtmlInputProcessor extends AbstractHtmlProcessor {
         * @param       boolean         $convertFromBBCode      interpret input as bbcode
         */
        public function process($html, $objectType, $objectID = 0, $convertFromBBCode = false) {
+               $this->reset();
+               
                $this->setContext($objectType, $objectID);
                
                // enforce consistent newlines
@@ -161,6 +163,14 @@ class HtmlInputProcessor extends AbstractHtmlProcessor {
                $this->context['objectID'] = $objectID;
        }
        
+       /**
+        * Resets internal states and discards references to objects.
+        */
+       protected function reset() {
+               $this->embeddedContent = [];
+               $this->htmlInputNodeProcessor = null;
+       }
+       
        /**
         * @return      IHtmlInputFilter
         */