summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/it_xml.t6
-rw-r--r--xml.class14
2 files changed, 12 insertions, 8 deletions
diff --git a/tests/it_xml.t b/tests/it_xml.t
index 06df969..85f16c8 100755
--- a/tests/it_xml.t
+++ b/tests/it_xml.t
@@ -51,15 +51,15 @@ function my_xml($xmldata)
$this->qux->val = "qux";
if (is_object($this->myfoo))
- $this->myfoo->properbaseclass = is_a($this->myfoo, "my_xml");
+ $this->myfoo->inheritbaseclass = is_a($this->myfoo, "my_xml");
}
}
match(
'<myfoo />',
- 'class myfoo { var $properbaseclass = true; }',
- 'Inheritance and constructor',
+ 'class myfoo { var $inheritbaseclass = false; }',
+ 'Inheritance and constructor (critical for e.g. tel_xmlentry)',
'my'
);
diff --git a/xml.class b/xml.class
index 8defa75..a315d3e 100644
--- a/xml.class
+++ b/xml.class
@@ -49,7 +49,6 @@ function from_xml($xmldata, $p)
$this->_p = $p + array('encoding' => "ISO-8859-1");
$this->_arrayforce = array_flip((array)$this->_p['forcearray']);
$this->_stack = array();
- $this->_baseclass = get_class($this);
unset($this->error);
$parser = xml_parser_create($this->_p['encoding']);
xml_set_object($parser, $this);
@@ -127,7 +126,7 @@ function start_element($parser, $name, $attrs)
$name = $this->_p['prefix'] . $name;
if (!class_exists($name))
- eval("class $name extends $this->_baseclass { function $name() {} }"); # Extend base class but overwrite constructor with an empty one
+ eval("class $name extends it_xml {}"); # Extending the base class caused problems with tel_xmlentry
if (!$this->_stack && !$this->_p['factory'])
array_unshift($this->_stack, &$this);
@@ -135,7 +134,7 @@ function start_element($parser, $name, $attrs)
array_unshift($this->_stack, new $name);
if (!is_a($this->_stack[0], "it_xml"))
- $this->error .= "Class $name used in it_xml for <$name> does not extend it_xml: Name clash?\n";
+ $this->error .= "Class $name used in it_xml for tag $name does not extend it_xml: Name clash?\n";
if ($attrs)
{
@@ -152,8 +151,13 @@ function end_element($parser, $name)
{
if (is_array($this->_stack[1]->$name))
array_push($this->_stack[1]->$name, &$this->_stack[0]);
- else if (/*isset XXX NEEDS DEBUGGING for tel detail links */($this->_stack[1]->$name))
- $this->_stack[1]->$name = array($this->_stack[1]->$name, &$this->_stack[0]);
+ else if (isset($this->_stack[1]->$name))
+ {
+ if (is_a($this->_stack[1]->$name, "it_xml"))
+ $this->_stack[1]->$name = array($this->_stack[1]->$name, &$this->_stack[0]);
+ else
+ $this->error .= "Variable $name used in it_xml for tag {$name} is already used in object: Name clash?\n";
+ }
else if (isset($this->_arrayforce[$name]))
$this->_stack[1]->$name = array(&$this->_stack[0]);
else