php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32472 DOMDocument::createElement changes property value
Submitted: 2005-03-28 13:12 UTC Modified: 2005-03-29 01:20 UTC
From: c dot d at earthlink dot net Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.0.3 OS: Mac OS X 10.3.8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: c dot d at earthlink dot net
New email:
PHP Version: OS:

 

 [2005-03-28 13:12 UTC] 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" }



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-29 01:17 UTC] c dot d at earthlink dot net
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.
 [2005-03-29 01:20 UTC] sniper@php.net
Sorry but we don't support any binary releases except for the win32 ones.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 05:01:33 2025 UTC