From:             greg at zwiffer dot org
Operating system: Debian GNU/Linux (unstable)
PHP version:      5.0.0
PHP Bug Type:     DOM XML related
Bug description:  Segfault by using the DOM attribute ownerDocument in a PHP object

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 bug report at http://bugs.php.net/?id=29221&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29221&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29221&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29221&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29221&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29221&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29221&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29221&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29221&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29221&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29221&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29221&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29221&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29221&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29221&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29221&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29221&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29221&r=float

Reply via email to