From:             andreas dot a dot sandberg at gmail dot com
Operating system: Ubuntu
PHP version:      5.3.13
Package:          DOM XML related
Bug Type:         Bug
Bug description:Additional xml declaration added to document when calling save

Description:
------------
It appears an extra xml declaration can get added as part of the output
when 
calling saveXML on a DOMDocument that was loaded by calling loadHTML.  Not
sure 
how common of a use case this is but I load by xhtml doc using the loadHTML
call 
as it is more forgiving and the content I'm loading already has the xml 
declaration.  Of course I can remove it but not sure if this is the
intended 
behavior. 

Test script:
---------------
$xml = '<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html><head></head><body></body></html>';

$dom = new DOMDocument();
$dom->loadHTML($xml);
$out = $dom->saveXML(null);

echo $out;



Expected result:
----------------
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<html><head/><body/></html>


Actual result:
--------------
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>
<?xml version="1.0" encoding="utf-8" standalone="no"??>
<html><head/><body/></html>


-- 
Edit bug report at https://bugs.php.net/bug.php?id=62259&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62259&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62259&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62259&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62259&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62259&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62259&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62259&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62259&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62259&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62259&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62259&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62259&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62259&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62259&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62259&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62259&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62259&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62259&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62259&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62259&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62259&r=mysqlcfg

Reply via email to