ID: 33261
Updated by: [EMAIL PROTECTED]
Reported By: breakpoint at gazeta dot pl
-Status: Open
+Status: Bogus
Bug Type: DOM XML related
Operating System: Linux Slackware 10
PHP Version: 5.0.3
New Comment:
no wonder, if you use saveHTML(). use saveXML() and everything works
fine. saveHTML() is meant to be used on HTML4 documents, where param
has a special meaning and is a tag which is not supposed to be closed.
Previous Comments:
------------------------------------------------------------------------
[2005-06-07 11:55:49] breakpoint at gazeta dot pl
I forget, whe we change line
$objParam = $objDOM->createElement('param'); //HERE!!
to for example
$objParam = $objDOM->createElement('params'); //HERE!!
sampel work fine...
------------------------------------------------------------------------
[2005-06-07 11:47:08] breakpoint at gazeta dot pl
Description:
------------
DOM in PHP5 eating ( ;-) ) close tag when I add tag <param>. I expected
<param ..></param> or <param/>. but DOM get <param> with out </param>
:-(
Sorry for my english - look in Reproduce code, and Expected and Actual
results.
Reproduce code:
---------------
<?php
$objDOM = new DOMDocument();
$objConfig = $objDOM->createElement('config');
$objDOM->appendChild($objConfig);
$objSettings = $objDOM->createElement('settings');
$objConfig->appendChild($objSettings);
for($i=0; $i<10; $i++) {
$objParam = $objDOM->createElement('param'); //HERE!!
$objParam->SetAttribute('name', '11');
$objParam->SetAttribute('value', '22');
$objConfig->appendChild($objParam);
}
echo htmlspecialchars($objDOM->saveHTML());
?>
Expected result:
----------------
<config><settings></settings><param name="11" value="22"></param><param
name="11" value="22"></param><param name="11" value="22"></param><param
name="11" value="22"></param><param name="11" value="22"></param><param
name="11" value="22"></param><param name="11" value="22"></param><param
name="11" value="22"></param><param name="11" value="22"></param><param
name="11" value="22"></param></config>
Actual result:
--------------
<config><settings></settings><param name="11" value="22"> <param
name="11" value="22"> <param name="11" value="22"> <param name="11"
value="22"> <param name="11" value="22"> <param name="11" value="22">
<param name="11" value="22"> <param name="11" value="22"> <param
name="11" value="22"> <param name="11" value="22"></config>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33261&edit=1