#29221 [Opn->Csd]: Segfault by using the DOM attribute ownerDocument in a PHP object
| From: | rrichards@php.net | Date: | Sun, 18 Jul 2004 11:50:09 +0000 |
| Subject: | #29221 [Opn->Csd]: Segfault by using the DOM attribute ownerDocument in a PHP object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-62571@lists.php.net to get a copy of this message | ||
ID: 29221
Updated by: rrichards@php.net
Reported By: greg at zwiffer dot org
-Status: Open
+Status: Closed
Bug Type: DOM XML related
Operating System: Debian GNU/Linux (unstable)
PHP Version: 5.0.0
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-07-17 12:12:40] chregu@php.net
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
;)
------------------------------------------------------------------------
[2004-07-17 12:09:28] chregu@php.net
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
;)
------------------------------------------------------------------------
[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