php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30480 CDATA section is not recognized as such
Submitted: 2004-10-19 16:20 UTC Modified: 2004-10-20 08:02 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:1 (33.3%)
From: tbrandl at barff dot de Assigned:
Status: Wont fix Package: DOM XML related
PHP Version: 4.3.8 OS: WinXP/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tbrandl at barff dot de
New email:
PHP Version: OS:

 

 [2004-10-19 16:20 UTC] tbrandl at barff dot de
Description:
------------
The first child of <data>, a CDATA-section, is not recognized as such, but identified as a text object.

According to the documentation, the type should be 4 instead of 3.

works (tested, that is) on 4.3.1, 4.3.6
fails on 4.3.8, 4.3.9

Reproduce code:
---------------
$xmlString = '<?xml version="1.0"?><root><data><![CDATA[Some CData content]]></data></root>';
$xml = domxml_open_mem($xmlString);

$node = $xml->get_elements_by_tagname('data');
$cdata_section = $node[0]->child_nodes();

echo phpversion();

print_r($cdata_section[0]);


Expected result:
----------------
4.3.6

domcdata Object
(
    [type] => 4
    [content] => Some CData content
    [0] => 3
    [1] => 12561912
)


Actual result:
--------------
4.3.8 / 4.3.9

domtext Object
(
    [type] => 3
    [name] => #text
    [content] => Some CData content
    [0] => 3
    [1] => 140237488
)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-20 08:02 UTC] chregu@php.net
technically there's is no difference between a text and 
a cdata section. CDATA is just another way to write text 
nodes. Internally it's the same (AFAIK).

We won't fix that.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC