Handle multiple ownerDocuments for args in Preprocessor_DOM
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 26 Aug 2014 15:20:00 +0000 (11:20 -0400)
committerJackmcbarn <jackmcbarn@gmail.com>
Tue, 26 Aug 2014 15:39:04 +0000 (15:39 +0000)
As long as Preprocessor_DOM::newPartNodeArray returns nodes with
different roots when called multiple times, PPFrame_DOM::newChild should
be prepared to receive such.

Bug: 70046
Change-Id: Ie048d8dbd3042f19d934ff0dd8d32b4c46f9f952

includes/parser/Preprocessor_DOM.php

index 8416ac3..2edb79a 100644 (file)
@@ -1033,7 +1033,7 @@ class PPFrame_DOM implements PPFrame {
                                if ( $arg instanceof PPNode ) {
                                        $arg = $arg->node;
                                }
-                               if ( !$xpath ) {
+                               if ( !$xpath || $xpath->document !== $arg->ownerDocument ) {
                                        $xpath = new DOMXPath( $arg->ownerDocument );
                                }