Req #65215 [Opn->Csd]: SimpleXMLElement could register as implementing Countable
| From: | cmb@php.net | Date: | Fri, 31 May 2019 17:23:41 +0000 |
| Subject: | Req #65215 [Opn->Csd]: SimpleXMLElement could register as implementing Countable | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-221068@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65215&edit=1
ID: 65215
Updated by: cmb@php.net
Reported by: ww dot galen at gmail dot com
Summary: SimpleXMLElement could register as implementing
Countable
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: SimpleXML related
PHP Version: 5.5.0
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
This request has been implemented[1], and SimpleXMLElement
implements Countable as of PHP 7.4.
[1] <http://git.php.net/?p=php-src.git;a=commit;h=bfc10978eff5793a68e7aeb6144b5a2a393833f3>
Previous Comments:
------------------------------------------------------------------------
[2013-07-07 05:19:55] ww dot galen at gmail dot com
Description:
------------
SimpleXMLElement is essentially a Countable (it matches the signature of the
interface), but doesn't register as implementing it.
The attached (untested) patch should register SimpleXMLElement as a Countable if
SPL is also being built. It does not cover the case where someone builds SPL as a
shared extension (does anyone do that?).
Test script:
---------------
<?php
$x = new SimpleXMLElement('<?xml
version="1.0"?><a><b/><c/></a>');
var_dump(count($x), $x instanceof Countable);
Expected result:
----------------
int(2)
bool(true)
Actual result:
--------------
int(2)
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65215&edit=1