Prevent processing of removed nodes
authorAlexander Ebert <ebert@woltlab.com>
Fri, 7 Oct 2016 08:32:50 +0000 (10:32 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 7 Oct 2016 08:32:50 +0000 (10:32 +0200)
wcfsetup/install/files/lib/system/html/node/AbstractHtmlNodeProcessor.class.php

index bda595329415004c44c2ed8c3072cd0fb15481e4..9fd0f2ffd02e07bb5bfde6ab2b83b19367d3992d 100644 (file)
@@ -83,11 +83,12 @@ abstract class AbstractHtmlNodeProcessor implements IHtmlNodeProcessor {
                $html = preg_replace('~^<body>~', '', $html);
                $html = preg_replace('~</body>$~', '', $html);
                
-               /** @var IHtmlNode $obj */
                foreach ($this->nodeData as $data) {
-                       $obj = $data['object'];
-                       $string = $obj->replaceTag($data['data']);
-                       $html = preg_replace_callback('~<wcfNode-' . $data['identifier'] . '>(?P<content>[\s\S]*)</wcfNode-' . $data['identifier'] . '>~', function($matches) use ($string) {
+                       $html = preg_replace_callback('~<wcfNode-' . $data['identifier'] . '>(?P<content>[\s\S]*)</wcfNode-' . $data['identifier'] . '>~', function($matches) use ($data) {
+                               /** @var IHtmlNode $obj */
+                               $obj = $data['object'];
+                               $string = $obj->replaceTag($data['data']);
+                               
                                if (mb_strpos($string, '<!-- META_CODE_INNER_CONTENT -->') !== false) {
                                        return str_replace('<!-- META_CODE_INNER_CONTENT -->', $matches['content'], $string);
                                }