Index: Tree.php =================================================================== RCS file: /repository/pear/XML_Tree/Tree.php,v retrieving revision 1.31 diff -u -r1.31 Tree.php --- Tree.php 18 Sep 2003 10:51:34 -0000 1.31 +++ Tree.php 9 Dec 2003 19:13:47 -0000 @@ -107,7 +107,8 @@ if (!is_null($this->root)) { return $this->root; } - return $this->raiseError("No root"); + $err = $this->raiseError('No root'); + return $err; } /** @@ -391,7 +392,8 @@ * @access public */ function &getName($name) { - return $this->root->getElement($this->namespace[$name]); + $tmp =& $this->root->getElement($this->namespace[$name]); + return $tmp; } /** @@ -421,24 +423,28 @@ function &getNodeAt($path) { if (is_null($this->root)){ - return $this->raiseError("XML_Tree hasn't a root node"); + $err = $this->raiseError('XML_Tree hasn\'t a root node'); + return $err; } if (is_string($path)) $path = explode("/", $path); if (sizeof($path) == 0) { - return $this->raiseError("Path to node is empty"); + $err = $this->raiseError('Path to node is empty'); + return $err; } $path1 = $path; $rootName = array_shift($path1); if ($this->root->name != $rootName) { - return $this->raiseError("Path does not match the document root"); + $err = $this->raiseError('Path does not match the document root'); + return $err; } $x =& $this->root->getNodeAt($path1); if (!PEAR::isError($x)) { return $x; } // No node with that name found - return $this->raiseError("Bad path to node: [".implode('/', $path)."]"); + $err = $this->raiseError('Bad path to node: ['.implode('/', $path).']'); + return $err; } /** @@ -454,10 +460,12 @@ function &getElementsByTagName($tagName) { if (empty($tagName)) { - return $this->raiseError('Empty tag name'); + $err = $this->raiseError('Empty tag name'); + return $err; } if (sizeof($this->children)==0) { - return null; + $tmp = null; + return $tmp; } $result = array(); foreach ($this->children as $child) { Index: Tree/Node.php =================================================================== RCS file: /repository/pear/XML_Tree/Tree/Node.php,v retrieving revision 1.18 diff -u -r1.18 Node.php --- Tree/Node.php 11 Sep 2003 19:03:27 -0000 1.18 +++ Tree/Node.php 9 Dec 2003 19:13:48 -0000 @@ -157,11 +157,13 @@ return $parent; } elseif ($parent != $this) { // Insert at the node found - return $parent->insertChild(null, $pos, $child, $content, $attributes); + $partent =& $parent->insertChild(null, $pos, $child, $content, $attributes); + return $parent; } if (($pos < -count($this->children)) || ($pos > count($this->children))) { - return new PEAR_Error("Invalid insert position."); + $err =& new PEAR_Error('Invalid insert position.'); + return $err; } if (is_object($child)) { // child is an object @@ -180,7 +182,8 @@ } $this->children[$pos] = $child->root; } else { - return new PEAR_Error("Bad node (must be a XML_Tree or an XML_Tree_Node)"); + $err =& new PEAR_Error('Bad node (must be a XML_Tree or an XML_Tree_Node)'); + return $err; } } else { // child offered is a string array_splice($this->children, $pos, 0, 'dummy'); @@ -205,11 +208,13 @@ function &removeChild($pos) { if (($pos < -count($this->children)) || ($pos >= count($this->children))) { - return new PEAR_Error("Invalid remove position."); + $err =& new PEAR_Error('Invalid remove position.'); + return $err; } // Using array_splice() instead of a simple unset() to maintain index-integrity - return array_splice($this->children, $pos, 1); + $tmp = array_splice($this->children, $pos, 1); + return $tmp; } /** @@ -343,7 +348,8 @@ } } - return new PEAR_Error("Bad path to node: [".implode('-', $path)."]"); + $err =& new PEAR_Error('Bad path to node: ['.implode('-', $path).']'); + return $err; } /**