From:             gmblar+php at gmail dot com
Operating system: MacOSX 10.5.8
PHP version:      5.3.0
PHP Bug Type:     DOM XML related
Bug description:  DOMDocument::loadHTMLFile add default Namespace even if it 
already exists

Description:
------------
DOMDocument::loadHTMLFile add default Namespace even if it already 
exists

Reproduce code:
---------------
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
        <head>
                <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8" />
                <title>DOM-Test</title>
        </head>
        <body>
                <p>Hello World</p>
        </body>
</html>


<?php

header('Content-Type: text/plain');
$dom = new DOMDocument();
$dom->formatOutput = true;
$dom->loadHTMLFile('test.html');
echo $dom->saveXML();

?>

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/>
    <title>DOM-Test</title>
  </head>
  <body>
    <p>Hello World</p>
  </body>
</html>


Actual result:
--------------
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml"; 
xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" 
/>
    <title>DOM-Test</title>
  </head>
  <body>
    <p>Hello World</p>
  </body>
</html>


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

Reply via email to