#33085 [NEW]: Adding a DTD with insertBefore doesn't update the document doctype attribute
| From: | verniera at free dot fr | Date: | Fri, 20 May 2005 14:49:08 +0000 |
| Subject: | #33085 [NEW]: Adding a DTD with insertBefore doesn't update the document doctype attribute | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-79263@lists.php.net to get a copy of this message | ||
From: verniera at free dot fr
Operating system: Windows XP
PHP version: 5.0.4
PHP Bug Type: DOM XML related
Bug description: Adding a DTD with insertBefore doesn't update the document doctype attribute
Description:
------------
Adding a DTD to an already loaded document properly adds the given Element
and Text to the document, but doesn't seem to update the document->doctype
properly.
Workaround found: Create a new document with the DTD and import the root
node of the document.
Note: It's my first try at reporting a bug, so I apologize if if it is not
clear.
Reproduce code:
---------------
$impl= new DomImplementation;
$dtd= $impl->createDocumentType("test", "", "loctest.dtd");
$dom=DOMDocument::load('C:\\Inetpub\\wwwroot\\cgi-bin\\testsDom\\test.xml');
$dom->standalone = "no";
$dom->insertBefore($dtd, $dom->firstChild);
if ($dom->validate())
echo "Valid";
else
echo "NOT Valid";
Expected result:
----------------
"Valid"
OR
"NOT Valid"
OR
An error indicating that I cannot add the DTD element
Actual result:
--------------
Notice: DOMDocument::validate() [function.validate]: No DTD given in
XML-Document in C:\Inetpub\wwwroot\cgi-bin\testsDom\addDtd.php on line 26
--
Edit bug report at http://bugs.php.net/?id=33085&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33085&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33085&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33085&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33085&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33085&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33085&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33085&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33085&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33085&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33085&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33085&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33085&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33085&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33085&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33085&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33085&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33085&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33085&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33085&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33085&r=mysqlcfg