Bug #53050 [NEW]: processing instructions won't append correctly

From: Date: Wed, 13 Oct 2010 00:25:11 +0000
Subject: Bug #53050 [NEW]: processing instructions won't append correctly
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-155122@lists.php.net to get a copy of this message
From:             
Operating system: Linux
PHP version:      5.2.14
Package:          DOM XML related
Bug Type:         Bug
Bug description:processing instructions won't append correctly

Description:
------------
In order to make my XHTML compatible with Internet Explorer it is
recommended (http://www.w3.org/MarkUp/2004/xhtml-faq#ie) to have
<?xml-stylesheet type="text/xsl" href="copy.xsl"?> as a processing
instruction. However, trying to append this does not work as expected.


Test script:
---------------
	$Implementation = new DOMImplementation();
	$Doctype = $Implementation->createDocumentType("html");
	$Document =
$Implementation->createDocument("http://www.w3.org/1999/xhtml", "html",
$Doctype);
	// Workaround for IE XHTML issues:
http://www.w3.org/MarkUp/2004/xhtml-faq#ie
	$IeXhtml = $Document->createProcessingInstruction("xml-stylesheet",
"type=\"text/xsl\" href=\"copy.xsl\"");
	$Document->documentElement->insertBefore($IeXhtml);
	$Head = $Document->createElement("head");
	$Title = $Document->createElement("title", "My page");
	$Head->appendChild($Title);
	$Document->documentElement->appendChild($Head);
	$Body = $Document->createElement("body");
	$Script = $Document->createElement("script", "");
	$Script->setAttribute("src", "test.js"); 
	$Script->setAttribute("type", "text/javascript");
	$Body->appendChild($Script);
	$Document->documentElement->appendChild($Body);
	echo $Document->saveXML();

Expected result:
----------------
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="copy.xsl"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>My page</title>
</head>
<body>
<script src=test.js" type="text/javascript"></script>
</body>
</html>


Actual result:
--------------
<?xml version="1.0"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<?xml-stylesheet type="text/xsl" href="copy.xsl"?>
<head>
<title>My page</title>
</head>
<body>
<script src=test.js" type="text/javascript"></script>
</body>
</html>

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



Thread (2 messages)

« previous php.bugs (#155122) next »