|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9740 wrong xml node content
Submitted: 2001-03-14 09:54 UTC Modified: 2001-08-26 04:53 UTC
From: marcel at humanique dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.0.4pl1 OS: Linux 2.2.16-3 (RH)
Private report: No CVE-ID: None
 [2001-03-14 09:54 UTC] marcel at humanique dot com
Element nodes contain the wrong content

When I loop through all the children of the node "root" of the following xml then the fourth child (second <my>)contains ($node->content) "2<newline><newline>3<newline><newline>" which should be nothing since its empty.
When I examine the output of a domxml_dumpmem dump of the $xml variable it does contain the correct data.
Libxml version is 2.3.2

<?xml version="1.0"?>

output of my script:
idx=0 name=text content=

idx=1 name=my content=1
idx=2 name=text content=

idx=3 name=my content=


idx=4 name=text content=

idx=5 name=my content=2
idx=6 name=text content=

idx=7 name=my content=

idx=8 name=text content=

idx=9 name=my content=3
idx=10 name=text content=
end of output

my script:

$txt  = "<?xml version=\"1.0\"?>\n";
$txt .= "<root>\n";
$txt .= "<my>1</my>\n";
$txt .= "<my/>\n";
$txt .= "<my>2</my>\n";
$txt .= "<my/>\n";
$txt .= "<my>3</my>\n";
$txt .= "</root>\n";

$xml = xmldoc($txt);

$root = $xml->children();

$children = $root[0]->children();

echo "<pre>\n";
for($i=0; $i < count($children); $i++) {
        echo "idx=$i name=" . $children[$i]->name;
        echo " content=" . $children[$i]->content;
        echo "\n";
echo "</pre>\n";


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-26 04:53 UTC]
Closed in CVS, fix will be part of 4.0.7.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Jun 01 23:03:37 2023 UTC