php.net |  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
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:4 of 4 (100.0%)
Same Version:3 (75.0%)
Same OS:1 (25.0%)
From: schst@php.net Assigned:
Status: No Feedback Package: XML related
PHP Version: 5.0.0b3 (beta3) OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: schst@php.net
New email:
PHP Version: OS:

 

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-20 22:17 UTC] 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-25 23:14 UTC] 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-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");
xml_parse($parser);
}

}

$a = new test;
$a->parse();
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC