|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65215 SimpleXMLElement could register as implementing Countable
Submitted: 2013-07-07 05:19 UTC Modified: -
Avg. Score:3.9 ± 0.8
Reproduced:6 of 6 (100.0%)
Same Version:1 (16.7%)
Same OS:0 (0.0%)
From: ww dot galen at gmail dot com Assigned:
Status: Open Package: SimpleXML related
PHP Version: 5.5.0 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-07-07 05:19 UTC] ww dot galen at gmail dot com
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:
$x = new SimpleXMLElement('<?xml version="1.0"?><a><b/><c/></a>');
var_dump(count($x), $x instanceof Countable);

Expected result:

Actual result:


simplexml_countable.patch (last revision 2013-07-07 05:24 UTC by ww dot galen at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon May 20 11:01:26 2019 UTC