|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66937 XSLTProcessor::transformToDoc causes separation of doctype and source document
Submitted: 2014-03-20 17:55 UTC Modified: -
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: sites at hubmed dot org Assigned:
Status: Open Package: XSLT related
PHP Version: 5.5.10 OS: OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
34 - 15 = ?
Subscribe to this entry?

 [2014-03-20 17:55 UTC] sites at hubmed dot org
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:

<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//example//EN" "">

Expected result:
<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//example//EN" "">

Actual result:
<?xml version="1.0"?>


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 21:01:25 2019 UTC