#32472 [Fbk->Opn]: DOMDocument::createElement changes property value

From: Date: Mon, 28 Mar 2005 23:17:35 +0000
Subject: #32472 [Fbk->Opn]: DOMDocument::createElement changes property value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75950@lists.php.net to get a copy of this message
 ID:               32472
 User updated by:  c dot d at earthlink dot net
 Reported By:      c dot d at earthlink dot net
-Status:           Feedback
+Status:           Open
 Bug Type:         DOM XML related
 Operating System: Mac OS X 10.3.8
 PHP Version:      5.0.3
 New Comment:

I'm using the Entropy 5.0.3 rev. 4 release. I'm sorry, but I just don't
know enough about building it myself. Pretty much any time I have for
programming I have to devote to php.

However, apparently 5.0.4 is emminent (according to php.internals). So
I'll report the results with that release when it becomes available
from the Entropy site.


Previous Comments:
------------------------------------------------------------------------

[2005-03-28 13:22:08] rrichards@php.net

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip



------------------------------------------------------------------------

[2005-03-28 13:12:16] c dot d at earthlink dot net

Description:
------------
I'm using libxml2 2.6.17.

In the following code, the call to createElement() changes the value of
the private property $rootTag to null.

Reproduce code:
---------------
<?php

ini_set('display_errors', '1');
error_reporting(E_ALL | E_STRICT);

class bdmDOMTable extends DOMDocument
{
    private $rootTag;
    private $rowTag;

    public function __construct($rootTag, $rowTag)
    {
        parent::__construct('1.0', 'UTF-8');

        $this->preserveWhiteSpace = FALSE;
        $this->formatOutput = FALSE;

        if ($rootTag) {
            $this->rootTag = $rootTag;
        }
        else {
            $this->rootTag = 'table';
        }
        
        if ($rowTag) {
            $this->rowTag = $rowTag;
        }
        else {
            $this->rowTag = 'row';
        }

        $this->appendChild($this->createElement($this->rootTag));

    }

}

$modulesDOM = new bdmDOMTable('modules', 'module');

var_dump($modulesDOM);
?>

Expected result:
----------------
object(bdmDOMTable)#1 (2) { ["rootTag:private"]=>  string(7) "modules"
["rowTag:private"]=>  string(6) "module" }

Actual result:
--------------
object(bdmDOMTable)#1 (2) { ["rootTag:private"]=>  NULL
["rowTag:private"]=>  string(6) "module" }




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32472&edit=1


Thread (4 messages)

« previous php.bugs (#75950) next »