Bug #18511: child_nodes() == 1 when has_child_nodes() == false
| From: | gk at proliberty dot com | Date: | Tue, 23 Jul 2002 20:00:42 +0000 |
| Subject: | Bug #18511: child_nodes() == 1 when has_child_nodes() == false | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-14941@lists.php.net to get a copy of this message | ||
From: gk@proliberty.com
Operating system: linux 2.4.18 kernel; Red Hat 7.2
PHP version: 4.2.1
PHP Bug Type: DOM XML related
Bug description: child_nodes() == 1 when has_child_nodes() == false
--- CODE:
<?php
$xmlstr = '<?xml version="1.0"?><root/>';
$doc = domxml_open_mem($xmlstr);
$root = $doc->document_element();
$childNodes = $root->child_nodes();
$count = count( $childNodes );
echo 'has_child_nodes is '; echo $root->has_child_nodes() ? 'true' :
'false';
echo "\nnumber of child nodes = $count\n";
?>
--- RESULT:
has_child_nodes is false
number of child nodes = 1
--- EXPECTED RESULT
has_child_nodes is false
number of child nodes = 0
--
Edit bug report at http://bugs.php.net/?id=18511&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18511&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18511&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18511&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18511&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18511&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18511&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18511&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18511&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18511&r=globals