#32494 [Com]: crash when using expat in a class
| From: | troels at kyberfabrikken dot dk | Date: | Mon, 31 Oct 2005 10:22:05 +0000 |
| Subject: | #32494 [Com]: crash when using expat in a class | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-87252@lists.php.net to get a copy of this message | ||
ID: 32494
Comment by: troels at kyberfabrikken dot dk
Reported By: evert at rooftopsolutions dot nl
Status: Verified
Bug Type: XML related
Operating System: Linux glibc 2.3.4
PHP Version: 4CVS-2005-07-30 (4 only!)
New Comment:
Does anybody know for how long this problem have existed ? Will it be
fixed with next release for php4 ?
xml_set_object does btw. not have the same problem.
Previous Comments:
------------------------------------------------------------------------
[2005-08-18 10:54:43] sniper@php.net
See also bug #34150
------------------------------------------------------------------------
[2005-05-17 10:46:57] sniper@php.net
Does NOT happen with PHP 5 (using libxml instead of expat)
------------------------------------------------------------------------
[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