|
Sorry if this isn’t the right place for this, but I’m not sure where this belongs.
I was going through the Varien_SimpleXml_Element class and discovered what I think might be some possible issues. I could be wrong, but thought I’d post just in case.
Varien_Simplexml_Element class
public function descend($path) { #$node = $this->xpath($path); #return $node[0];
$pathArr = explode('/', $path); $desc = $this; foreach ($pathArr as $nodeName) { if (strpos($nodeName, '@')!==false) { $a = explode('@', $nodeName); $b = explode('=', $a[1]); $nodeName = $a[0]; $attributeName = $b[0]; $attributeValue = $b[1]; $found = false; foreach ($this->$nodeName as $desc) { if ((string)$nodeChild[$attributeName]===$attributeValue) { $found = true; break; } } if (!$found) { $desc = false; } } else { $desc = $desc->$nodeName; } if (!$desc) { return false; } } return $desc; }
shouldn’t the following line:
foreach ($this->$nodeName as $desc) { if ((string)$nodeChild[$attributeName]===$attributeValue) { $found = true; break; }
be:
foreach ($this->$nodeName as $desc => $nodeChild) { if ((string)$nodeChild[$attributeName]===$attributeValue) { $found = true; break; }
Otherwise, $nodeChild remains undefined.
|