Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96214 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33072 invoked from network); 4 Oct 2016 10:30:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2016 10:30:06 -0000 Authentication-Results: pb1.pair.com header.from=php@duncanc.co.uk; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@duncanc.co.uk; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain duncanc.co.uk from 209.85.215.53 cause and error) X-PHP-List-Original-Sender: php@duncanc.co.uk X-Host-Fingerprint: 209.85.215.53 mail-lf0-f53.google.com Received: from [209.85.215.53] ([209.85.215.53:34739] helo=mail-lf0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F4/CE-06241-BA483F75 for ; Tue, 04 Oct 2016 06:30:05 -0400 Received: by mail-lf0-f53.google.com with SMTP id b81so59195088lfe.1 for ; Tue, 04 Oct 2016 03:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=duncanc-co-uk.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ssBPRlaz3a+Xu1gM/oGAgQof5Qf93gexKdHTkPUIC2A=; b=gBXalmLLcE/hhFbEHyzt6zKbxO1KQbT3Hpl9cdE+YLkM4+rT3JYtR3EFo27G4ehw/K 0v6alFOBrru7kzZX+PcWDhbNCT83s1lcfJN3/j9puC1hpxo65lBBP9iObT4+ji0D0Ntm HGArenHa9zFLNyAUbd3LoZbH/Wa5pTUQnjljoCtXVtZJZ0gS0OOA0+KNWRCSImZFtmd1 Dzre+L1td0TdJZNAm9copMzQXfTClC2RqLL8Uiifl1ByI26ItRDMLEE6S6ZlCbmI/Onk S0MjjzGt8/NdTMvfuSDX/wahFuYa7p52ZeoDJn/kJLug+UUrp8RCZn6QP1v913Acf23/ ZLvg== 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=ssBPRlaz3a+Xu1gM/oGAgQof5Qf93gexKdHTkPUIC2A=; b=aTD2X92QEljthKFEnNjd70r3iRHz3NYYIJFn48rx1O/efc4Sblu7dGRvrTgN2wSt3k cvm+UoXKIgzUzLpVHUASglI3m0RrM1M/LNbp+sC4YRxZGUQqiMbEpsVtrJpGGiLHqnpl zWYy9iisC3xDoUSBmWarcekKRlZJH+VgJhBS1+gWp69EUnlSEh7u9He66WqFzccnvrK6 x3xPXNDR/EomO0hhrhRG85FGNefVmNdalLSvL7jdcqT91J3qQHs3ORJQEkuUs4wwlWAB LEHuEI40TvzoHYxygN/kf/ob86XN/SoZWyo1mQ4Q3w2L/JrXLwq8B4uvXeOfM6ISv3I1 8Iug== X-Gm-Message-State: AA6/9RnIde3XmtS7FWeAPGOiuT4TpGFewBtJWBD1oXMdXPQqAP6ULltSoZM3KPIO3isCAw== X-Received: by 10.46.71.79 with SMTP id u76mr1098078lja.14.1475576999920; Tue, 04 Oct 2016 03:29:59 -0700 (PDT) Received: from mail-lf0-f46.google.com (mail-lf0-f46.google.com. [209.85.215.46]) by smtp.gmail.com with ESMTPSA id f9sm584522lji.19.2016.10.04.03.29.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Oct 2016 03:29:59 -0700 (PDT) Received: by mail-lf0-f46.google.com with SMTP id t81so110928990lfe.0 for ; Tue, 04 Oct 2016 03:29:59 -0700 (PDT) X-Received: by 10.25.15.220 with SMTP id 89mr1142216lfp.101.1475576998758; Tue, 04 Oct 2016 03:29:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.114.120.163 with HTTP; Tue, 4 Oct 2016 03:29:58 -0700 (PDT) X-Originating-IP: [195.99.194.20] In-Reply-To: References: Date: Tue, 4 Oct 2016 11:29:58 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Leigh Cc: Internals Content-Type: multipart/alternative; boundary=001a113f9102d9a75c053e078a0d Subject: Re: [PHP-DEV] [RFC] Counting of non-countable objects From: php@duncanc.co.uk (Craig Duncan) --001a113f9102d9a75c053e078a0d Content-Type: text/plain; charset=UTF-8 On 4 October 2016 at 11:17, Leigh wrote: > You specifically mention that counting scalars is unaffected, is there > a legitimate use-case for being able to use count() on them? > > I'd say using count() on a string or an int also constitutes a hidden > bug, as it also always returns 1 regardless of the value. > I agree, and I'm happy to include scalars in the RFC if that's desired by the majority. Calling count() on a scalar is likely to cause a warning at some point, so it's not as "hidden" as the iterator example: if (count($string) > 0) { foreach ($string as $value) { --001a113f9102d9a75c053e078a0d--