Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96942 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12172 invoked from network); 17 Nov 2016 07:30:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Nov 2016 07:30:45 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 209.85.214.50 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 209.85.214.50 mail-it0-f50.google.com Received: from [209.85.214.50] ([209.85.214.50:38702] helo=mail-it0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 62/7A-05303-3AC5D285 for ; Thu, 17 Nov 2016 02:30:45 -0500 Received: by mail-it0-f50.google.com with SMTP id j191so27903501ita.1 for ; Wed, 16 Nov 2016 23:30:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pthreads-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=+znqcBDTbhEmn4Yuq9/6wnXTtkRORw3BgrkMTWGxxwM=; b=v1m8UDelFAQYY/h8tokzU3fNbcAZBzxwiro30rYy6RJFiy91fVH6Zlxx4/OlBoWftE Ctoe6fGki5JNoThkEymG5fiTv9yOXhuSmeI6NFm6HPPWs1UtvWfepeksiyGMd6i7ScKk PTPQxd13KAMT5K+wYHUnM7X67GOYczOXz6eGnB6qsFWKmLwrtK3aZKza/yaZmtUT2yGm B/1gxBz1FgpSAYQp3hY2LPjC/G8tG9aJh3FT555CAYShWjkAi51JkiIykS/QlgvUafxK +EQue4LtW4YbCOj0kuBdRRpUrR5Qml7Uy3QZDBAyZZqEplxPEXaP2ehe0wF0IJ8f+k2s xyOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=+znqcBDTbhEmn4Yuq9/6wnXTtkRORw3BgrkMTWGxxwM=; b=Dr2Es/UvLx88Z+AkhITeUYbIYdwWEDRE97KOyIUB73DL0KfODbIryPUgpKKlwTDIBg WwZ11zEkebJKMw/CPT8j/T4tSVTV1WGBgl9JU1kaAZPRDXTElD3xQlppoTD5fEsjqN4l 8JhAOP+3WGRijWXsFvmpJb1jQDl1/EJ+6yFR/hv6/ZIEQxnkfqmP723KcCm9rcPSktTm qxUI/bh44aCkvHTKSy80drviaXmAjBsc2jxHAoYkyZHXEjptdDrmTOAhtCvIg0B5JGPK ayEmdtlxss1gIuxZnB1oeVtv80+K8DCWYs3BRG0xjoXmGsaxzamKX17xN422m+7RmSYr uf/A== X-Gm-Message-State: AKaTC01DO/loNgIYBtsReO2r3uQigOjdjDpSlxLqy+Tow9mHv0X6EOUnXEnF67pnJJSHHtefdI83/VnHA26yZg== X-Received: by 10.107.168.223 with SMTP id e92mr1712833ioj.40.1479367841112; Wed, 16 Nov 2016 23:30:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.102.3 with HTTP; Wed, 16 Nov 2016 23:30:40 -0800 (PST) X-Originating-IP: [109.157.245.230] In-Reply-To: References: <2b46dcb5-03e2-59dd-b04f-d1877fd603bc@gmx.de> <9c4e33c3-cd8c-dc29-89d2-c91abfb702e0@gmx.de> Date: Thu, 17 Nov 2016 07:30:40 +0000 Message-ID: To: Nikita Popov Cc: "Christoph M. Becker" , Craig Duncan , Niklas Keller , Internals Content-Type: multipart/alternative; boundary=001a114275bca987ee05417a2aaf Subject: Re: [PHP-DEV] How to detect classes with a count_elements handler in userland? From: pthreads@pthreads.org (Joe Watkins) --001a114275bca987ee05417a2aaf Content-Type: text/plain; charset=UTF-8 Morning, Just to chime in ... can you split the PR into the RFC, and the new thing please. Just another question on how we could make objects that have count_elements (which is in object handlers) implement an interface on the class entry (which is detached from handlers) ? I'm sure it's doable, but it doesn't look very straight forward, some kind of hacking in instanceof maybe ... not sure ... Cheers Joe On Wed, Nov 16, 2016 at 9:02 PM, Nikita Popov wrote: > On Mon, Nov 14, 2016 at 2:22 PM, Christoph M. Becker > wrote: > > > On 13.11.2016 at 22:10, Craig Duncan wrote: > > > > >> How about just making those classes implement the interface instead? > > > > > > Christoph pointed out that there may be classes in extensions that use > > > count_elements. > > > > Furthermore, letting those classes implement Countable could break BC. > > > > How would this break BC? > > SXE even already has a count() method, and count_elements respects > overrides of that method. Clearly SXE is supposed to implement Countable, > it was simply forgotten. > > > Also it would make userland code simpler: > > > is_countable($thing) > > > vs > > > is_array($thing) || $thing implements \Countable > > > > Good catch! > > > > Note that Craig has added is_countable() to PR #2185 (which implements > > the RFC). In my opinion, that is okay, but if anybody has objections, > > we probably need another RFC. > > > > This should be done as a separate change IMHO. > > Nikita > --001a114275bca987ee05417a2aaf--