summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Schneider2007-02-08 15:01:20 +0000
committerChristian Schneider2007-02-08 15:01:20 +0000
commit0b9f19b72396d8bd399f4d7353f2fdb445bc55f3 (patch)
treeb93c766adb7dd8fb7a4f9c21f97821c16fdf75ea
parent6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb (diff)
downloaditools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.tar.gz
itools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.tar.bz2
itools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.zip
Removed base class inheritance again, check for var name class (tel_xmlentry)
-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