1) Added parameter 'parent' to XDebugVariable, so we can determine whether a variable...
[phpeclipse.git] / net.sourceforge.phpeclipse.xdebug.core / src / net / sourceforge / phpeclipse / xdebug / php / model / XDebugObjectValue.java
index 1af871a..4e7be86 100644 (file)
@@ -1,5 +1,7 @@
 package net.sourceforge.phpeclipse.xdebug.php.model;
 
+import java.util.ArrayList;
+
 import net.sourceforge.phpeclipse.xdebug.core.PHPDebugUtils;
 
 import org.eclipse.debug.core.DebugException;
@@ -10,29 +12,38 @@ import org.w3c.dom.NodeList;
 public class XDebugObjectValue extends XDebugAbstractValue {
        private int NumChildren;
 
-       public XDebugObjectValue(XDebugStackFrame variable, Node value) throws DebugException {
+       public XDebugObjectValue(XDebugStackFrame variable, Node value, XDebugVariable parent) throws DebugException {
                super(variable, value);
 
                NumChildren = 0;
                if (!PHPDebugUtils.getAttributeValue(value, "numchildren").equals("")) {
                        NumChildren = Integer.parseInt(PHPDebugUtils.getAttributeValue(value, "numchildren"));
-               }               
+               }
 
                if (NumChildren > 0) {
                        NodeList property = value.getChildNodes();
-                       IVariable[] Variables = new IVariable[property.getLength()];
-                       
-                       for (int i = 0; i<property.getLength(); i++) {
+
+                       ArrayList a = new ArrayList();
+                       for (int i = 0; i < property.getLength(); i++) {
                                Node propertyNode = property.item(i);
-                               Variables[i] = new XDebugVariable(variable, propertyNode);
+                               /*
+                                * Eliminate CLASSNAME duplicate from object properties.
+                                * see http://bugs.xdebug.org/view.php?id=518
+                                * and http://svn.xdebug.org/cgi-bin/viewvc.cgi/xdebug/trunk/xdebug_var.c?root=xdebug&r1=2962&r2=2996
+                                */
+                               String name     = PHPDebugUtils.getAttributeValue (propertyNode, "name");
+
+                               if (!name.equals ("CLASSNAME")) {
+                                       a.add(new XDebugVariable(variable, propertyNode, parent));
+                               }
                        }
-                       
-                       setChildren(Variables);
+
+                       setChildren((IVariable[])a.toArray(new IVariable[a.size()]));
                }
-               
+
                String className = PHPDebugUtils.getAttributeValue(value,"classname");
                if(!"".equals(className)) {
                        setValueString(className);
                }
        }
-}
\ No newline at end of file
+}