diff options
author | Christian Schneider | 2007-02-08 15:01:20 +0000 |
---|---|---|
committer | Christian Schneider | 2007-02-08 15:01:20 +0000 |
commit | 0b9f19b72396d8bd399f4d7353f2fdb445bc55f3 (patch) | |
tree | b93c766adb7dd8fb7a4f9c21f97821c16fdf75ea | |
parent | 6943a9f3bc10a60fcc01f126dfbd22b24b9c99cb (diff) | |
download | itools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.tar.gz itools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.tar.bz2 itools-0b9f19b72396d8bd399f4d7353f2fdb445bc55f3.zip |
Removed base class inheritance again, check for var name class (tel_xmlentry)
-rwxr-xr-x | tests/it_xml.t | 6 | ||||
-rw-r--r-- | xml.class | 14 |
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' ); @@ -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 |