Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96877 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14018 invoked from network); 13 Nov 2016 20:24:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Nov 2016 20:24:50 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.221 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.221 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.221] ([81.169.146.221:33753] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E4/99-31581-01CC8285 for ; Sun, 13 Nov 2016 15:24:48 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1479068684; l=1934; s=domk; d=kelunik.com; h=Content-Type:Cc:To:Subject:Date:From:References:In-Reply-To: MIME-Version; bh=hH8BWXHqdeMrsRuVkkHv8xP0K3roc/BePv09TeOb+Mk=; b=pQO2KZCONpiDIdSLVnfzFSL8VglFsj54Hc7xXh3WuXC/QQ0DKeYbjoKAoulkKLhbDE WTwqMY1IPWYHtoj8bMu0JOcaXRnjOe8/fn7bDtHVR5ABSCAWdniT2g65EQh90+PHWSPX 21u1LzQJSQEFvs/eGmn78iE4k8aNdpfGdBE5o= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLGvomb4bl9EfHtO3o6 X-RZG-CLASS-ID: mo00 Received: from mail-wm0-f49.google.com ([74.125.82.49]) by smtp.strato.de (RZmta 39.9 AUTH) with ESMTPSA id t08650sADKOirQw (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp384r1 with 384 ECDH bits, eq. 7680 bits RSA)) (Client did not present a certificate) for ; Sun, 13 Nov 2016 21:24:44 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id t79so65633664wmt.0 for ; Sun, 13 Nov 2016 12:24:44 -0800 (PST) X-Gm-Message-State: ABUngvej+7L3Jka0rypPXoAUTVKZ+nNnjeYcEfRAvio2w6VwcIChb7t4Tb+a2pT58pcEGhMmYhZZ1owXEI4Mvw== X-Received: by 10.194.164.226 with SMTP id yt2mr19720532wjb.201.1479068684240; Sun, 13 Nov 2016 12:24:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.80.135.133 with HTTP; Sun, 13 Nov 2016 12:24:43 -0800 (PST) In-Reply-To: <2b46dcb5-03e2-59dd-b04f-d1877fd603bc@gmx.de> References: <2b46dcb5-03e2-59dd-b04f-d1877fd603bc@gmx.de> Date: Sun, 13 Nov 2016 21:24:43 +0100 X-Gmail-Original-Message-ID: Message-ID: To: "Christoph M. Becker" Cc: PHP Internals , Craig Duncan Content-Type: multipart/alternative; boundary=089e0117740f85edcd05413483d5 Subject: Re: [PHP-DEV] How to detect classes with a count_elements handler in userland? From: me@kelunik.com (Niklas Keller) --089e0117740f85edcd05413483d5 Content-Type: text/plain; charset=UTF-8 2016-11-13 18:34 GMT+01:00 Christoph M. Becker : > Hi! > > In the discussion on PR #2185[1] we've stumbled upon the issue of > internal classes implementing a count_elements handler (but not the > Countable interface). > > Is it possible to detect this in userland? If not, I would suggest that > we introduce something like is_countable(), so users can check whether > count() may be safely called on a given value. > > [1] > How about just making those classes implement the interface instead? Regards, Niklas --089e0117740f85edcd05413483d5--