|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10254 xml_set_object() and segmentation fault
Submitted: 2001-04-09 18:06 UTC Modified: 2002-02-19 00:00 UTC
From: mnino at insight dot com Assigned:
Status: No Feedback Package: XML related
PHP Version: 4.0.4pl1 OS: Redhat 6.2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2001-04-09 18:06 UTC] mnino at insight dot com
I am receiving "segmentation fault" when using xml_set_object() and setting handlers in the constructor. I moved them to the parse() method and the crashes stop. I found the resolution for a similiar issue in the feedback thread at the end of xml_set_object() documentation just in case you guys are already aware of this issue : )

Feedback Thread
06-Dec-2000 12:42 
If xml_set_object is not called in the constructor of an object, the values that the parser modifies will be saved. Else, the values do not seem to be saved as stated by "i_sofer" above. 
--- Start Example Code --- 
class foo { 
var xmlparser; 
function foo() { \\the constructor 
function parse() { 
\\also include data handler 
\\and element handlers here 
--- End Example Code --- 

My Code

function parse($data) {
    $this->parser = xml_parser_create();
    if (!xml_parse($this->parser, $data, 1)) {
       $error = sprintf("XML error: %s at line %d",
       echo $error;
    } // if
} // fn     


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-13 07:13 UTC]
Can you try this with latest release 4.1.1?
 [2002-02-19 00:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 09:01:29 2024 UTC