Bug #66937 [NEW]: XSLTProcessor::transformToDoc causes separation of doctype and source document

From: Date: Thu, 20 Mar 2014 17:55:28 +0000
Subject: Bug #66937 [NEW]: XSLTProcessor::transformToDoc causes separation of doctype and source document
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184845@lists.php.net to get a copy of this message
From: sites at hubmed dot org Operating system: OS X PHP version: 5.5.10 Package: XSLT related Bug Type: Bug Bug description:XSLTProcessor::transformToDoc causes separation of doctype and source document Description: ------------ Calling XSLTProcessor::transformToDoc (which would be expected not to alter the source document) on a DOMDocument that has a doctype causes the doctype to be somehow "separated" from the document, so that the doctype is no longer included when writing out the original document. A workaround is to clone the DOMDocument object before calling transformToDoc on it, but this shouldn't be necessary. I notice that the "nextSibling" property of the DOMDocumentType object is lost during the transformation. ===== Tested with PHP 5.5.10 and 5.4.24. libxml2 Version => 2.9.0 libxslt Version => 1.1.28 Test script: --------------- https://gist.github.com/hubgit/9669288 Input: <?xml version="1.0"?> <!DOCTYPE article PUBLIC "-//example//EN" "http://example.org/dtd"> <article/> Expected result: ---------------- <?xml version="1.0"?> <!DOCTYPE article PUBLIC "-//example//EN" "http://example.org/dtd"> <article/> Actual result: -------------- <?xml version="1.0"?> <article/> -- Edit bug report at https://bugs.php.net/bug.php?id=66937&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66937&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66937&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66937&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66937&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66937&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66937&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66937&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66937&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66937&r=support Expected behavior: https://bugs.php.net/fix.php?id=66937&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66937&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66937&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66937&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66937&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66937&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66937&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66937&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66937&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66937&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66937&r=mysqlcfg

« previous php.bugs (#184845) next »