|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74837 Request: DOMNodeList should implement Countable starting in php 7.2 (or php 8?)
Submitted: 2017-06-30 21:47 UTC Modified: -
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: tandre at themeetgroup dot com Assigned:
Status: Closed Package: DOM XML related
PHP Version: 7.2.0alpha2 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.
Block user comment
Status: Assign to:
Bug Type:
From: tandre at themeetgroup dot com
New email:
PHP Version: OS:


 [2017-06-30 21:47 UTC] tandre at themeetgroup dot com
See - It's surprising that it isn't Countable, and it should be fairly easy to do.

It has a `length` property already, and is a type of list.

Code using `count($domNodeList)` would start emitting notices in php 7.2, and currently the default `count` is unintuitive.

In php 7.2.0alpha1, and 7.1, and any other version:

php > $x = new Domnodelist();
php > echo count($x);

Warning: count(): Parameter must be an array or an object that implements Countable in php shell code on line 1


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-10 06:50 UTC]
Automatic comment on behalf of remi
Log: Fixed bug #74837 - NEWS
 [2017-07-10 06:50 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Sep 22 16:01:24 2023 UTC