|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26981 xml_parse looses object reference
Submitted: 2004-01-20 14:33 UTC Modified: 2004-01-25 23:14 UTC
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:1 (25.0%)
From: Assigned:
Status: No Feedback Package: XML related
PHP Version: 5.0.0b3 (beta3) OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2004-01-20 14:33 UTC]
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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 22:17 UTC]
Please try using this CVS snapshot:
For Windows:

Also provide a SHORT example script. 
(No, PEAR scripts are NOT good test scripts!!)

 [2004-01-25 23:14 UTC]
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-31 20:46 UTC] rctman at bellsouth dot net
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");


$a = new test;
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Dec 10 11:01:26 2023 UTC