|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-04-06 05:00 UTC] david dot seidel at one-jinx dot de
Description:
------------
If written a class that uses xml_set_object(...). In PHP5.0.0RC1 this works correctly, but in PHP Version 5.0.0RC2-dev (php5-200404060630) my script produces a lot of warnings like "Warning: xml_parse() [function.xml-parse]: Unable to call handler tag_open() in ...". When I use function instead of the methods, everything seems to work correctly.
Reproduce code:
---------------
class blwTemplateEngine
...
public function __construct(...) {
$this->parser = xml_parser_create();
xml_set_object($this->parser, $this);
xml_set_element_handler($this->parser, "tag_open", "tag_close");
xml_set_character_data_handler($this->parser, "cdata");
$this->setOption(XML_OPTION_CASE_FOLDING, false);
}
...
protected final function tag_open($parser, $tag, $attributes) {}
protected final function tag_close($parser, $tag) {}
protected final function cdata($parser, $cdata) {}
...
}
Expected result:
----------------
render a Template
Actual result:
--------------
Warning: xml_parse() [function.xml-parse]: Unable to call handler cdata() in /srv/www/htdocs/bluewonder_neo/bluewonder/base/template/blwTemplateEngine.php on line 156
line 156:
if(!xml_parse($this->parser, $data)) {
throw new Exception("XML-Parser-Error: Error in ".$this->templatePath." - ".xml_error_string(xml_get_error_code($this->parser)). " (Error-Code: ".xml_get_error_code($this->parser).") at line ".xml_get_current_line_number($this->parser)." and column ".xml_get_current_column_number($this->parser));
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 21:00:01 2025 UTC |
class XMLParser { var $parser = null; public function __construct($xml) { $this->parser = xml_parser_create(); xml_set_object($this->parser, $this); xml_set_element_handler($this->parser, "tag_open", "tag_close"); xml_set_character_data_handler($this->parser, "cdata"); xml_parser_set_option ( $this->parser, XML_OPTION_CASE_FOLDING,false); } public function tag_open($parser, $tag, $attributes){} public function tag_close($parser, $tag) {} public function cdata($parser, $data) {} } $string="<?xml version="1.0"?><root>test</root>"; $foo = new XMLParser($string);