ID: 29221
Updated by: [EMAIL PROTECTED]
Reported By: greg at zwiffer dot org
Status: Open
Bug Type: DOM XML related
Operating System: Debian GNU/Linux (unstable)
PHP Version: 5.0.0
New Comment:
I can reproduce it (latest CVS HEAD).. Did shortly look
at the source code, but I couldn't figure out, why it
sefgaults.
Something bad happens in
if ((intern = (dom_object *)
php_dom_object_get_data((void *) obj))) {
in the function
zval *php_dom_create_object(xmlNodePtr obj, int *found,
zval *wrapper_in, zval *return_value, dom_object *domobj
TSRMLS_DC)
Maybe Rob looks into it later, or when I have more time
;)
Previous Comments:
------------------------------------------------------------------------
[2004-07-17 10:23:07] greg at zwiffer dot org
Description:
------------
PHP segfault when I use the DOM attribute ownerDocument in a PHP
object. See the code for what happened.
I try with the command line :
/opt/php5/bin/php -q my_file.php
I use a Debian GNU/Linux unstable with PHP 5.0.0, but I had also the
problem with PHP 5.0.0RC3. Here is my version of libxml2 :
ii libxml2 2.6.11-1 GNOME XML library
ii libxml2-dev 2.6.11-1 Development files for the GNOME XML
library
I compile PHP with the following configure line :
./compile --with-prefix=/opt/php5 --with-xsl --with-mysql
Thanks
Reproduce code:
---------------
<?php
class XMLReader {
public $doc = NULL ;
public function __construct($xml) {
$dom = new DOMDocument() ;
$dom->loadXML($xml) ;
$this->doc = $dom->documentElement ;
}
public function owner() {
return get_class($this->doc->ownerDocument) ;
}
}
$dom = new DOMDocument() ;
$dom->loadXML('<test>This is a test</test>') ;
$docElt = $dom->documentElement ;
echo get_class($docElt->ownerDocument) ; // no segfault
$xml = new XMLReader('<test>This is a test</test>') ;
echo get_class($xml->doc->ownerDocument) ; //segfault
$xml = new XMLReader('<test>This is a test</test>') ;
echo get_class($xml->owner()) ; //segfault
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29221&edit=1