ID:               37440
 User updated by:  kenashkov at gmail dot com
 Reported By:      kenashkov at gmail dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         XML related
 Operating System: Fedora Core 4
 PHP Version:      4.4.2
 New Comment:

No - it is not. I have a full working example class - the same result.
The inexpected here is that the parser can not call the registered
methods. Obviuosly I do not expect to work - the source is scaled down
to the bare minimum that reproduces the case.


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

[2006-05-14 20:29:16] [EMAIL PROTECTED]

This is expected since your handlers do not return anything.

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

[2006-05-14 20:11:51] kenashkov at gmail dot com

Description:
------------
When assigning multiple times to ane variable an object which contains
a XML parser, there is a problem when the xml_parse is called. The
parser can not call the registered handlers.
The problem can be avoided if the variable is unset before the second
call, or using $doc1 =& new xml_doc() for every assignment.

Reproduce code:
---------------
<?
class xml_doc
{
function xml_doc()
        {
        $this->res = xml_parser_create_ns();
        xml_set_object($this->res,$this);
        xml_set_element_handler($this->res,'start_element','end_element');
        }
        
function load_string($string)
        {
        xml_parse($this->res,$string);
        }
        
function start_element()
        {
        }
        
function end_element()
        {
        }
}

$str = '<?xml version="1" encoding="UTF-8"
standalone="yes"?><root></root>';
$doc1 = new xml_doc();
$doc1->load_string($str);
//unset($doc1);//this solves the problem
//or using $doc1 =& new xml_doc(); in every assignment
$doc1 = new xml_doc();
$doc1->load_string($str);
?>

Expected result:
----------------
Nothing really... it is too simple to do real parsing.

Actual result:
--------------
Warning: xml_parse() [function.xml-parse.html]: Unable to call handler
start_element() in file.php on line 13

Warning: xml_parse() [function.xml-parse.html]: Unable to call handler
end_element() in file.php on line 13


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


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

Reply via email to