|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67949 DOMNodeList should implement ArrayAccess
Submitted: 2014-09-02 13:21 UTC Modified: 2014-11-17 14:46 UTC
Avg. Score:4.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: Assigned: fmargaine (profile)
Status: Closed Package: DOM XML related
PHP Version: Irrelevant OS: Any
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
46 + 26 = ?
Subscribe to this entry?

 [2014-09-02 13:21 UTC]
DOMNodeList should implement ArrayAccess. The write methods should either silently fail or throw a DOMException (probably the latter).

It would probably also be an idea to implement Countable at the same time, allowing for better interop between node lists and arrays of nodes.

Test script:

$html = <<<HTML
$doc = new DOMDocument;

Expected result:
string(4) "data"

Actual result:
Fatal error: Cannot use object of type DOMNodeList as array in...


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-09-24 20:08 UTC]
-Assigned To: +Assigned To: fmargaine
 [2014-10-09 09:02 UTC]

master PR ( still pending, but shouldn't have any issue since the 5.6 PR was merged.
 [2014-11-17 14:46 UTC]
-Status: Assigned +Status: Closed
 [2014-11-17 14:46 UTC]
Released in 5.6.3
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 29 22:01:29 2024 UTC