DomNode->append_child() does not append attribute nodes

Bug #23326 DomNode->append_child() does not append attribute nodes
Submitted: 2003-04-24 08:18 UTC Modified: 2003-09-09 15:49 UTC
Votes:6
Avg. Score:4.3 ± 1.1
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: markus dot pfefferle at web dot de Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4CVS-2003-04-24 (stable) OS: Windows 2000
Private report: No CVE-ID: None

 [2003-04-24 08:18 UTC] markus dot pfefferle at web dot de

This works:

  $document = domxml_new_doc('1.0');
  $test = $document->append_child($document->create_element('test'));
  $test->set_attribute('key', 'value');
  echo htmlspecialchars($document->dump_mem(1));

This does not:

  $document = domxml_new_doc('1.0');
  $test = $document->append_child($document->create_element('test'));
  $test->append_child($document->create_attribute('key', 'value'));
  echo htmlspecialchars($document->dump_mem(1));

Also doesn't work on 4.3.1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports

 [2003-04-25 03:59 UTC] chregu@php.net

isn't implemented

you have to use $element->set_attribute_node()

which only is available in CVS HEAD. You could try the php_domxml.dll from the latest cvs-snapshot

 [2003-04-25 04:16 UTC] markus dot pfefferle at web dot de

How my daddy used to day:

"if it ain't implemented, don't document it!"

 [2003-08-22 13:18 UTC] p0wer at bojko dot krakow dot pl

Does not work for 4.3.3RC3 on Linux (Debian Sid) either.

 [2003-09-09 15:49 UTC] msopacua@php.net

This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.