Req #67949 [Asn->Csd]: DOMNodeList should implement ArrayAccess

From: Date: Mon, 17 Nov 2014 14:46:27 +0000
Subject: Req #67949 [Asn->Csd]: DOMNodeList should implement ArrayAccess
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188638@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67949&edit=1 ID: 67949 Updated by: fmargaine@php.net Reported by: daverandom@php.net Summary: DOMNodeList should implement ArrayAccess -Status: Assigned +Status: Closed Type: Feature/Change Request Package: DOM XML related Operating System: Any PHP Version: Irrelevant Assigned To: fmargaine Block user comment: N Private report: N New Comment: Released in 5.6.3 Previous Comments: ------------------------------------------------------------------------ [2014-10-09 09:02:56] fmargaine@php.net PHP-5.6: https://github.com/php/php-src/commit/9469db93110b2185f019da0dd66d3537c1a4b7a4 master PR (https://github.com/php/php-src/pull/842) still pending, but shouldn't have any issue since the 5.6 PR was merged. ------------------------------------------------------------------------ [2014-09-02 13:21:37] daverandom@php.net Description: ------------ 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: --------------- <?php $html = <<<HTML <div>data</div> HTML; $doc = new DOMDocument; $doc->loadHTML($html); var_dump($doc->getElementsByTagName('div')[0]->textContent); Expected result: ---------------- string(4) "data" Actual result: -------------- Fatal error: Cannot use object of type DOMNodeList as array in... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67949&edit=1

« previous php.bugs (#188638) next »