From: michael at elfimov dot com
Operating system: Linux
PHP version: 5.0.0RC1
PHP Bug Type: XML related
Bug description: xml_parse cause segmentation fault when xml_set_object called from
class method
Description:
------------
xml_parse cause segmentation fault when xml_set_object called from class
member function (as showed in example below). When xml_set_object called
from class constructor or from "parse" class method then things going ok,
but when xml_set_object placed in "init" class method then things going
wrong.
Reproduce code:
---------------
<?php
class sxml {
var $handle;
function start_elem($parser,$name,$attribs) {
print "$name ";
foreach($attribs as $key => $value) {
print "$key = $value ";
}
print "\n";
}
function end_elem()
{
}
function init() {
$this->handle = xml_parser_create("ISO-8859-1");
xml_set_object($this->handle, $this);
xml_set_element_handler($this->handle,'start_elem','end_elem');
xml_parser_set_option($this->handle,XML_OPTION_CASE_FOLDING,0);
}
function release() {
xml_parser_free($this->handle);
}
function parse($source) {
$this->init();
xml_parse($this->handle, $source);
$this->release();
}
}
$source = '<OBJECT>
<CLIENT_ID>1</CLIENT_ID>
<CLIENT_CAT_ID>3</CLIENT_CAT_ID>
<USER_ID>1</USER_ID>
<GROUP_ID>2</GROUP_ID>
<SESSION_CODE>6f121f896c1db735891d28448b02b978</SESSION_CODE>
</OBJECT>';
$obj = new sxml;
$obj->parse($source);
?>
Expected result:
----------------
OBJECT
CLIENT_ID
CLIENT_CAT_ID
USER_ID
GROUP_ID
SESSION_CODE
Actual result:
--------------
Segmentation fault
--
Edit bug report at http://bugs.php.net/?id=27821&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=27821&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=27821&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=27821&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=27821&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=27821&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=27821&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=27821&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=27821&r=support
Expected behavior: http://bugs.php.net/fix.php?id=27821&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=27821&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=27821&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=27821&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27821&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=27821&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=27821&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=27821&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27821&r=float