ID: 32494
Updated by: [EMAIL PROTECTED]
Reported By: evert at rooftopsolutions dot nl
Status: Verified
Bug Type: XML related
Operating System: Linux glibc 2.3.4
PHP Version: 4CVS-2005-03-30
New Comment:
Does NOT happen with PHP 5 (using libxml instead of expat)
Previous Comments:
------------------------------------------------------------------------
[2005-05-05 01:01:03] evert at rooftopsolutions dot nl
Thank you rmartins!!!
------------------------------------------------------------------------
[2005-05-05 00:10:43] rmartins at dcc dot online dot pt
Try freeing the parser via xml_parser_free()
Ricardo Martins
------------------------------------------------------------------------
[2005-03-30 02:05:33] evert at rooftopsolutions dot nl
Description:
------------
My PHP crashes when using expat functions in a class.
My scripts opens the 'test' file, but it doesn't matter if it exists or
not.
Right now I'm unable to check this with the latest cvs, but I did test
this on multiple servers running 4.3.10
Reproduce code:
---------------
<?
class sParser {
function onStartElement($parser,$name,$attribs) {
return false;
}
function onEndElement($parser,$name) {
return false;
}
function onCDATA($parser,$data) {
return false;
}
function onProcessInstruction($parser,$target,$data) {
return false;
}
function onXMLError($line,$errorcode,$errorstring) {
return false;
}
function xmlparse($data) {
$this->parser = xml_parser_create('UTF-8');
xml_parser_set_option($this->parser,XML_OPTION_CASE_FOLDING,false);
xml_set_element_handler($this->parser,array($this,
'onStartElement'),array($this,'onEndElement'));
xml_set_character_data_handler($this->parser,array($this,'onCDATA'));
xml_set_processing_instruction_handler($this->parser,array($this,'onProcessInstruction'));
if (!xml_parse($this->parser,$data)) {
$this->onXMLError(xml_get_current_line_number($this->parser),
xml_get_error_code($this->parser),
xml_error_string(xml_get_error_code($
this->parser)));
return false;
} else return $this->parsedData;
}
function execute($data) {
return $this->xmlparse($data);
}
}
$disp = new sParser();
$disp->execute(file_get_contents('test'));
?>
Expected result:
----------------
No errors
Actual result:
--------------
PHP Crash
my apache logs says:
[Tue Mar 29 07:07:25 2005] [notice] child pid 9106 exit signal Aborted
(6)
*** glibc detected *** double free or corruption (!prev): 0x08205058
***
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32494&edit=1