#24044 [Opn]: DOCTYPE breaks CDATA handling
ID: 24044
User updated by: theseer@php.net
Reported By: theseer@php.net
Status: Open
Bug Type: DOM XML related
Operating System: Linux
PHP Version: 4.3.2
New Comment:
Just cross-checked with the DTD for XHTML 1.0 Trans:
<!-- style info, which may include CDATA sections -->
<!ELEMENT style (#PCDATA)>
<!ATTLIST style
%i18n;
id ID #IMPLIED
type %ContentType; #REQUIRED
media %MediaDesc; #IMPLIED
title %Text; #IMPLIED
xml:space (preserve) #FIXED 'preserve'
>
The <script> MAY have a CDATA but it's not required to. Thus the
automatic addtion is a bug. ( imho )
Previous Comments:
------------------------------------------------------------------------
[2003-06-05 11:29:08] theseer@php.net
Forgot to mention what is actually 'wrong' :>
The // in the script block gets wrapped - <![CDATA[//]]> - which is not
an expected (automated) behavior and wrong.
------------------------------------------------------------------------
[2003-06-05 11:16:39] theseer@php.net
Hi..!
The following code parses the same XML Structure and dumps it right
away. The only difference is the 'missing' doctpye for the later one.
Even though the output differs a lot ;)
I'm not exactly sure if this is a php or more a libxml bug. It used to
work on php 4.3.1 with LibXML2 2.4.19, wheras it does not on 4.3.2 with
libxml2 2.5.x
<?PHP
$xml=<<<EOF
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
some markup...
<script>//<![CDATA[ .. some js code ]]></script>
some more markup
</body>
</html>
EOF;
$dom=domxml_open_mem($xml);
echo $dom->dump_mem(true, 'UTF-8');
$xml2=<<<EOF
<?xml version="1.0" encoding="iso-8859-1"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
some markup...
<script>//<![CDATA[ .. some js code ]]></script>
some more markup
</body>
</html>
EOF;
$dom=domxml_open_mem($xml2);
echo $dom->dump_mem(true, 'UTF-8');
?>
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=24044&edit=1
Thread (7 messages)