php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30875 xml_parse_into_struct() does not resolve entities in element content
Submitted: 2004-11-24 00:11 UTC Modified: 2016-06-29 18:40 UTC
Votes:9
Avg. Score:3.9 ± 1.0
Reproduced:3 of 5 (60.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: joern_h at gmx dot net Assigned:
Status: Verified Package: XML related
PHP Version: 4CVS, 5CVS (2005-02-03) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: joern_h at gmx dot net
New email:
PHP Version: OS:

 

 [2004-11-24 00:11 UTC] joern_h at gmx dot net
Description:
------------
When using xml_parse_into_struct, entities from the internal dtd are not resolved in element content. Entities in attribute values are resolved properly. This bug is present in PHP 4.3.8 and PHP5 (cvs from 2004-11-22).

Reproduce code:
---------------
<?php

$xml = <<<HERE
<!DOCTYPE test [
    <!ENTITY test "test">
]>
<test>&test;</test>
HERE;

$parser =& xml_parser_create();

xml_parse_into_struct($parser, $xml, $vals, $idx);

print_r($vals);

xml_parser_free($parser);

?>


Expected result:
----------------
Array
(
    [0] => Array
        (
            [tag] => TEST
            [type] => complete
            [level] => 1
            [value] => test
        )
)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [tag] => TEST
            [type] => complete
            [level] => 1
        )
)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-03 14:59 UTC] joern_h at gmx dot net
This bug still occurs with current PHP4 (Feb  3 2005 06:13:06) and PHP5 (Feb  3 2005 12:17:00) snapshots.
 [2005-02-16 07:35 UTC] sniper@php.net
After some investigating of the issue: ext/xml just misses this functionality. No bug but feature request -> reclassified.

 [2010-12-01 16:17 UTC] jani@php.net
-Summary: ext/xml: xml_parse_into_struct() does not resolve entities in element content +Summary: xml_parse_into_struct() does not resolve entities in element content -Package: Feature/Change Request +Package: XML related
 [2016-06-29 18:40 UTC] cmb@php.net
-Status: Analyzed +Status: Verified
 [2016-06-29 18:40 UTC] cmb@php.net
> When using xml_parse_into_struct, entities from the internal dtd
> are not resolved in element content. Entities in attribute
> values are resolved properly.

Indeed, see <https://3v4l.org/8cgbf>. In my opinion, this
inconsistency is a bug.
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC