php.net |  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: -
Votes:2
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
 [2017-06-30 21:47 UTC] tandre at themeetgroup dot com
Description:
------------
See https://secure.php.net/domnodelist - 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
1
```


Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-10 06:50 UTC] remi@php.net
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=6f97fb47ca31681670bf5ac4b2f8ea4f3a47a3cd
Log: Fixed bug #74837 - NEWS
 [2017-07-10 06:50 UTC] remi@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Dec 03 16:01:33 2024 UTC