Fix wrong return value in Preprocessor::getChildrenOfType
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 5 Aug 2012 20:14:45 +0000 (22:14 +0200)
committerumherirrender <umherirrender_de.wp@web.de>
Sun, 5 Aug 2012 20:14:45 +0000 (22:14 +0200)
I am not sure, but this looks wrong, because it adds the type to the
array and not the child.
This method is unused in core and wmf extensions, maybe
removing/deprecating is a better idea, but I am not sure, if that is
possible.
I have only see this possible error, while looking through the
preprocessor.

Change-Id: I5b7492d455989a8a3e71b5db6d31091b986c502a

includes/parser/Preprocessor_Hash.php
includes/parser/Preprocessor_HipHop.hphp

index 0e202fd..9296e3f 100644 (file)
@@ -1574,7 +1574,7 @@ class PPNode_Hash_Tree implements PPNode {
                $children = array();
                for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
                        if ( isset( $child->name ) && $child->name === $name ) {
-                               $children[] = $name;
+                               $children[] = $child;
                        }
                }
                return $children;
index d7b0716..4ef5ca9 100644 (file)
@@ -1758,7 +1758,7 @@ class PPNode_HipHop_Tree implements PPNode {
                $children = array();
                for ( $child = $this->firstChild; $child; $child = $child->nextSibling ) {
                        if ( isset( $child->name ) && $child->name === $name ) {
-                               $children[] = $name;
+                               $children[] = $child;
                        }
                }
                return $children;