Bug #51534 [Bgs]: DOMImplementation::createDocument() does not correctly append children

2010-04-12 Thread jameswithers89 at googlemail dot com
Edit report at http://bugs.php.net/bug.php?id=51534edit=1

 ID:   51534
 User updated by:  jameswithers89 at googlemail dot com
 Reported by:  jameswithers89 at googlemail dot com
 Summary:  DOMImplementation::createDocument() does not correctly
   append children
 Status:   Bogus
 Type: Bug
 Package:  DOM XML related
 Operating System: Fedora 12 GNU/Linux
 PHP Version:  5.3.2

 New Comment:

At http://www.w3.org/TR/DOM-Level-3-Core/introduction.html it states
Each 

document contains zero or one doctype nodes, one document element node,
and zero 

or more comments or processing instructions; the document element serves
as the 

root of the element tree for the document. Correct me if I'm wrong but
if that 

is the case then shouldn't the product of:



$document =
$implementation-createDocument('http://www.w3.org/1999/xhtml', 

'html', $doctype);



use the method DOMNode::appendChild() 'correctly' and place the child
element 

within its tags (as a child) rather than next to it (as a sibling)?



In the meantime, the following code gets the desired effect. It does
seem a 

rather long way of locating the document/root element and appending a
child to 

it:

?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

$document =
$implementation-createDocument('http://www.w3.org/1999/xhtml', 

'html', $doctype);

$head = $document-createElement('head');

$html = $document-getElementsByTagName('html');

$html = $html-item(0);

$html-appendChild($head);

echo $document-saveXML();


Previous Comments:

[2010-04-12 16:40:02] rricha...@php.net

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

It's appending exactly where you are telling it to


[2010-04-11 19:58:30] jameswithers89 at googlemail dot com

The following code also produces the same error:

?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

// Don't create a root element...

$document = $implementation-createDocument(null, null, $doctype);

// ...instead create a html element and set the xmlns attribute:

$html = $document-createElement('html');

$html-setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');

$document-appendChild($html);

$head = $document-createElement('head');

$document-appendChild($head);

echo $document-saveHTML();


[2010-04-11 19:40:38] jameswithers89 at googlemail dot com

Description:

The product of DOMDocument::createDocument() appends children outside of
the qualified name of the document element (i.e. the root element). 



I am using php-5.3.2-1.fc12.i686 and php-xml-5.3.2-1.fc12.i686 installed
using Yellowdog Updater, Modified Package Manager. All other DOM methods
tried so far work fine.



Test script:
---
?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

$document =
$implementation-createDocument('http://www.w3.org/1999/xhtml', 'html',
$doctype);

$head = $document-createElement('head');

$document-appendChild($head);

echo $document-saveHTML();





Expected result:

!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;

head/head

/html

Actual result:
--
!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;/htmlhead/head






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51534edit=1


[PHP-BUG] Bug #51534 [NEW]: DOMImplementation::createDocument() does not correctly append children

2010-04-11 Thread jameswithers89 at googlemail dot com
From: 
Operating system: Fedora 12 GNU/Linux
PHP version:  5.3.2
Package:  DOM XML related
Bug Type: Bug
Bug description:DOMImplementation::createDocument() does not correctly append 
children

Description:

The product of DOMDocument::createDocument() appends children outside of
the qualified name of the document element (i.e. the root element). 



I am using php-5.3.2-1.fc12.i686 and php-xml-5.3.2-1.fc12.i686 installed
using Yellowdog Updater, Modified Package Manager. All other DOM methods
tried so far work fine.



Test script:
---
?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

$document = $implementation-createDocument('http://www.w3.org/1999/xhtml',
'html', $doctype);

$head = $document-createElement('head');

$document-appendChild($head);

echo $document-saveHTML();





Expected result:

!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;

head/head

/html

Actual result:
--
!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;/htmlhead/head

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



Bug #51534 [Opn]: DOMImplementation::createDocument() does not correctly append children

2010-04-11 Thread jameswithers89 at googlemail dot com
Edit report at http://bugs.php.net/bug.php?id=51534edit=1

 ID:   51534
 User updated by:  jameswithers89 at googlemail dot com
 Reported by:  jameswithers89 at googlemail dot com
 Summary:  DOMImplementation::createDocument() does not correctly
   append children
 Status:   Open
 Type: Bug
 Package:  DOM XML related
 Operating System: Fedora 12 GNU/Linux
 PHP Version:  5.3.2

 New Comment:

The following code also produces the same error:

?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

// Don't create a root element...

$document = $implementation-createDocument(null, null, $doctype);

// ...instead create a html element and set the xmlns attribute:

$html = $document-createElement('html');

$html-setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');

$document-appendChild($html);

$head = $document-createElement('head');

$document-appendChild($head);

echo $document-saveHTML();


Previous Comments:

[2010-04-11 19:40:38] jameswithers89 at googlemail dot com

Description:

The product of DOMDocument::createDocument() appends children outside of
the qualified name of the document element (i.e. the root element). 



I am using php-5.3.2-1.fc12.i686 and php-xml-5.3.2-1.fc12.i686 installed
using Yellowdog Updater, Modified Package Manager. All other DOM methods
tried so far work fine.



Test script:
---
?php

$implementation = new DOMImplementation();

$doctype = $implementation-createDocumentType('html');

$document =
$implementation-createDocument('http://www.w3.org/1999/xhtml', 'html',
$doctype);

$head = $document-createElement('head');

$document-appendChild($head);

echo $document-saveHTML();





Expected result:

!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;

head/head

/html

Actual result:
--
!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;/htmlhead/head






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51534edit=1


[PHP-BUG] Bug #51530 [NEW]: DOMDocument::createElement() does not handle link correctly

2010-04-10 Thread jameswithers89 at googlemail dot com
From: 
Operating system: Fedora 12 GNU/Linux
PHP version:  5.3.2
Package:  DOM XML related
Bug Type: Bug
Bug description:DOMDocument::createElement() does not handle link correctly

Description:

DOMDocument::createElement() does not add a closing /link tag with
DOMDocument::createElement('link'). It outputs element rather than
element/element.



I am using php-5.3.2-1.fc12.i686 and php-xml-5.3.2-1.fc12.i686 installed
using Yellowdog Updater, Modified Package Manager. All other DOM methods
tried so far work fine.

Test script:
---
?php

$implementation = new DOMImplementation();

$document = $implementation-createDocument(null, null,
$implementation-createDocumentType('html'));

$html = $document-createElement('html');

$head = $document-createElement('head');

$stylesheet = $document-createElement('link');

$title = $document-createElement('title', 'Possible link error');

$body = $document-createElement('body');

$html-setAttribute('xmlns', 'http://www.w3.org/1999/xhtml');

$stylesheet-setAttribute('href','style.css');

$stylesheet-setAttribute('rel','stylesheet');

$stylesheet-setAttribute('type','text/css');

$document-appendChild($html);

$html-appendChild($head);

$html-appendChild($body);

$head-appendChild($stylesheet);

$head-appendChild($title);

echo $document-saveHTML();

Expected result:

!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;

head

link href=style.css rel=stylesheet type=text/css/link

titlePossible link error/title

/head

body/body

/html

Actual result:
--
!DOCTYPE html

html xmlns=http://www.w3.org/1999/xhtml;

head

link href=style.css rel=stylesheet type=text/css

titlePossible link error/title

/head

body/body

/html



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