#26981 [Com]: xml_parse looses object reference

From: Date: Sun, 01 Feb 2004 01:46:22 +0000
Subject: #26981 [Com]: xml_parse looses object reference
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-54225@lists.php.net to get a copy of this message
ID: 26981 Comment by: rctman at bellsouth dot net Reported By: schst@php.net Status: No Feedback Bug Type: XML related Operating System: Windows PHP Version: 5.0.0b3 (beta3) New Comment: here is an example: class test { function startElement($a, $b, $c) { print "start"; } function endElement($a, $b) { print "end"; } function characterData($a, $b) { print $b; } function parse() { $parser = xml_parser_create(); xml_set_object($parser, &$this); xml_set_element_handler($parser, "startElement", "endElement"); xml_set_character_data_handler($parser, "characterData"); xml_parse($parser); } } $a = new test; $a->parse(); Previous Comments: ------------------------------------------------------------------------ [2004-01-25 23:14:12] sniper@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. ------------------------------------------------------------------------ [2004-01-20 22:17:28] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip Also provide a SHORT example script. (No, PEAR scripts are NOT good test scripts!!) ------------------------------------------------------------------------ [2004-01-20 14:33:52] schst@php.net Description: ------------ If using xml_set_object() to register handlers in an object, xml_parse sometimes looses the reference to the object and displays a warning: Warning: xml_parse() [function.xml-parse]: Unable to call handler startHandler() in C:\php4\PEAR\XML\Parser.php on line 264 Try PEAR::XML_RDDL to see the bug in action. If registering xml_set_element_handler( $p, array( $obj, 'method' ), array( $obj, 'method' ) ) it seems to work fine. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26981&edit=1

« previous php.bugs (#54225) next »