ID:               27882
 User updated by:  david dot seidel at one-jinx dot de
 Reported By:      david dot seidel at one-jinx dot de
-Status:           Feedback
+Status:           Open
 Bug Type:         XML related
 Operating System: Linux (2.4.19)
 PHP Version:      5CVS-2004-04-06 (dev)
 New Comment:

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);


Previous Comments:
------------------------------------------------------------------------

[2004-04-07 10:59:49] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2004-04-06 05:00:30] 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));

                }






------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27882&edit=1

Reply via email to