|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-03-30 02:05 UTC] 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 ***
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 15:00:01 2025 UTC |
Still seeing this same issue in PHP 4.4.7 (two years later?!) with the CPanel build of Apache and PHP on Centos "4.5". Seeing core dumps with vBulletin's cron job, upgrading to PHP 5.x not a short-term option on the shared box in question. -------------------------------------------------------- Back trace from the vBulletin cron.php throws me: #0 0xffffe410 in __kernel_vsyscall () #1 0x4a2137a5 in raise () from /lib/tls/libc.so.6 #2 0x4a215209 in abort () from /lib/tls/libc.so.6 #3 0x4a247a1a in __libc_message () from /lib/tls/libc.so.6 #4 0x4a24e2bf in _int_free () from /lib/tls/libc.so.6 #5 0x4a24e63a in free () from /lib/tls/libc.so.6 #6 0x08148414 in poolDestroy (pool=0x4a315840) at /home/cpapachebuild/buildapache/php-4.4.7/ext/xml/expat/xmlparse.c:5425 #7 0x0814a38b in php_XML_ParserFree (parser=0x86844d0) at /home/cpapachebuild/buildapache/php-4.4.7/ext/xml/expat/xmlparse.c:1055 etc etc etc -------------------------------------------------------- Instant "*** glibc detected *** double free or corruption" occurs: class test { function test() { // initialize parser $this->parser = xml_parser_create(); xml_set_element_handler( $this->parser, array( & $this, "startTag" ), array( & $this, "endTag" ) ); } } $parser = new test(); -------------------------------------------------------- Sigh, I'm guessing we may be SoL on this one...