|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79852 count(DOMNodeList) doesn't match count(IteratorIterator(DOMNodeList))
Submitted: 2020-07-13 13:33 UTC Modified: -
From: Assigned:
Status: Closed Package: SimpleXML related
PHP Version: 8.0.0alpha2 OS: archLinux
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
New email:
PHP Version: OS:


 [2020-07-13 13:33 UTC]
Originally found as - it seems the new SimpleXMLIterator broke something wrt iterator_iterator, there is a mismatch in counts, and count(IteratorIterator(DOMNodeList)) throws an Exception that doesn't seem necessary

Test script:
$XML = <<< XML

$dom = new DomDocument();
$items = $dom->getElementsByTagName('item');

echo "Count: ".count($items). PHP_EOL;
$it = new IteratorIterator($items);
$c = iterator_count($it);
echo "Count: $c", PHP_EOL;

Expected result:
Count: 3
Count: 3

Actual result:
Count: 3
Count: 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-14 10:31 UTC]
Automatic comment on behalf of
Log: Fixed bug #79852
 [2020-07-14 10:31 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jul 15 00:01:28 2024 UTC