Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77418 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49997 invoked from network); 21 Sep 2014 21:44:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Sep 2014 21:44:18 -0000 Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.45 as permitted sender) X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 209.85.219.45 mail-oa0-f45.google.com Received: from [209.85.219.45] ([209.85.219.45:50424] helo=mail-oa0-f45.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 38/E2-16580-1B64F145 for ; Sun, 21 Sep 2014 17:44:18 -0400 Received: by mail-oa0-f45.google.com with SMTP id m1so2817822oag.18 for ; Sun, 21 Sep 2014 14:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9Cmq6UImeFSMJtiN3t7ewEqYo1pUeIpd/O/OFomfrUo=; b=HI6UpB1KJQe2SLXifWvCsy2eO5FTuaPncncqghf+7Gbq0sfBAGlBovhTNqiTUnFFd/ YbCaAJl2UjEiStxecJkqCcLqKYbZ++C+R3bvzKrvQckFeZ2RUADpBg28Wbw6CL3ChyxV FzuW5vjxhpFnWB9Z5yhCFgIbiXmt+C0CgggPaxT2qEaNhqgWWIVGkRxKe3aoj060m4b/ z9dhu6COpXQOt92tDOTdFx/QMY51Qh8AadkNovdpMZ/7iNE7nrS2PSFbg3lDtIDqFUPG lxE3jpsv+1GBHlP1k7ZkEpDt8h5C/NcZ4yu5hU2HqKMmPnJiqNW/KdxDc0538HFe3e5g gNNA== X-Received: by 10.182.246.39 with SMTP id xt7mr4589301obc.63.1411335854494; Sun, 21 Sep 2014 14:44:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.86.164 with HTTP; Sun, 21 Sep 2014 14:43:34 -0700 (PDT) In-Reply-To: References: Date: Sun, 21 Sep 2014 22:43:34 +0100 Message-ID: To: Florian Margaine Cc: PHP internals Content-Type: multipart/alternative; boundary=001a11c2e224441e6505039a3c79 Subject: Re: [PHP-DEV] Request #67949 DOMNodeList should implement ArrayAccess From: petercowburn@gmail.com (Peter Cowburn) --001a11c2e224441e6505039a3c79 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 21 September 2014 12:39, Florian Margaine wrote: > Hi list, > > The request is so that we can do this: > > $html =3D <<
data
> HTML; > $doc =3D new DOMDocument; > $doc->loadHTML($html); > var_dump($doc->getElementsByTagName('div')[0]->textContent); > > I started implementing this on my branch ( > https://github.com/Ralt/php-src/tree/issue-67949), but then I was > thinking... ::offsetSet and ::offsetUnset don't really make sense in this > context. > > From what I understand, SimpleXML does some magic to make it work without > implementing ArrayAccess. > > I think it's cleaner to use ArrayAccess and to throw errors on ::offsetSe= t > and ::offsetUnset, but I'd like internals' opinion on this. > The DOM has a very specific API that we should be keeping to, and encouraging developers to use. I=E2=80=99d *much* rather see the DOM implementation completed (check out a= ll of the =E2=80=9Cnot implemented=E2=80=9D parts we have), than some shiny, shin= y array-style access to NodeList items. That said, people do like the shiny, shiny. > > Regards, > > *Florian Margaine* > --001a11c2e224441e6505039a3c79--