xml_parse -> seg fault
Posted: Mon Oct 23, 2006 2:57 pm
Hi. I have problems with the xml extension when using xml_set_object.
Simplified script:the output is:
new MyClass xml_parser_create xml_set_element_handler xml_set_object data xml_parse Segmentation fault
Only happens when xml_set_object is called. Without an object all is fine.
I'm using openSuSE 10.1 and php 5.1.2.
Anybody with the same issue or even better: with a solution to the problem? Hints are welcome.
TIA Mark
Simplified script:
Code: Select all
<?php
class MyClass
{
function startElement($parser, $name, $attribs)
{
if ($name=="BODY")
{
echo "+"; flush();
}
}
function endElement($parser, $name)
{
if ($name=="BODY")
{
echo "-"; flush();
}
}
}
echo "new MyClass "; flush();
$o = new MyClass;
echo "xml_parser_create "; flush();
$parser = xml_parser_create();
echo "xml_set_element_handler "; flush();
xml_set_element_handler($parser, "startElement", "endElement");
echo "xml_set_object "; flush();
xml_set_object($parser, $o);
echo "data "; flush();
$data = "<root><body></body><body></body></root>";
echo "xml_parse "; flush();
xml_parse($parser, $data, true);
echo "xml_get_error_code "; flush();
echo xml_get_error_code($parser); flush();
?>new MyClass xml_parser_create xml_set_element_handler xml_set_object data xml_parse Segmentation fault
Only happens when xml_set_object is called. Without an object all is fine.
I'm using openSuSE 10.1 and php 5.1.2.
Anybody with the same issue or even better: with a solution to the problem? Hints are welcome.
TIA Mark