Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96213 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31254 invoked from network); 4 Oct 2016 10:17:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2016 10:17:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.50 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.218.50 mail-oi0-f50.google.com Received: from [209.85.218.50] ([209.85.218.50:33828] helo=mail-oi0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 84/6E-06241-4C183F75 for ; Tue, 04 Oct 2016 06:17:41 -0400 Received: by mail-oi0-f50.google.com with SMTP id n132so165091088oih.1 for ; Tue, 04 Oct 2016 03:17:40 -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; bh=o4FPl1SblZg95t1AYIc+Qh5eLIO0Yk1DOjnUc/5wAsc=; b=0oWjpVPoQLwaRl+kzpS0WQ++3L74OhBjU0LnBdIAMwYavSNGcBOTShZj3qMzKLblMC Zje/GHAuJ3rCf93aqIawqOWiLycL25GOYlWQFkgdBjdBwH9p8gFFhkBaLsOGImGIdgWy 2NmsJwbfT2+Jbr/WNn1gSHl/xAynFKAq0T6Z/8LMAvMHuWi9nEQZKwoxa45zMFh4yzYx ShBR+QgO21SG3UaS3jHqmmfQB1yr5nD6lxK16dLqmH4lkSa7zA1bNUoHxdHx3/X9TjiN tXYcakebglCRLs5+PIzqwNv7yhhkJOPtaQAuqkJ1N98/U7jg2sYgKqCemLvg9Aucq2yv CRpA== 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=o4FPl1SblZg95t1AYIc+Qh5eLIO0Yk1DOjnUc/5wAsc=; b=MGuFkh13kA12ZqtTzzDrHwyY3RQ1PcRp9M53sPGFNYRc8wAhbUHFjLzSrRMtBeJp4N +z42at1gnWrLQM7ZRUiZ44Ede/m5LsdQU6yousCY8pzG9+FX7VFQH0w+wYjWDprRrJXV 68Q0h67oW386XsOr6LJIxvDUaaUVvpYY5/+7wkJ/a9U1CO2Q4MPm9eBIOZhYmpscbvC0 ROHfFStbBmiNuVyiQjYLlTnSCkG0WmhuG+F1kNpixV3jQtJyEU9Nrk5rwhFeFd5vDdVg 1VTlUyznjc4EWoaPSX+ef/X3RF+DXLIysUGq79+8z50Hxvmjos/hZidJdKNLfW8EMi0+ 0H4w== X-Gm-Message-State: AA6/9RlpxNfF0nvNM6ixBGcUmx8vCMLrEt1iTT/BE0G4wzMvwg+ktchYqBrR3lhx2d9YtO0uptDKEtVdx6rHZw== X-Received: by 10.157.37.44 with SMTP id k41mr1807323otb.110.1475576256869; Tue, 04 Oct 2016 03:17:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.60.199 with HTTP; Tue, 4 Oct 2016 03:17:36 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Oct 2016 11:17:36 +0100 Message-ID: To: Craig Duncan Cc: Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Counting of non-countable objects From: leight@gmail.com (Leigh) On 4 October 2016 at 10:32, Craig Duncan wrote: > Hi everybody > > I'd like to propose the introduction of warning when counting objects that > can't be counted. > > The default behaviour is to return 1 for these objects, which can be > misleading and hide bugs when attempting to count iterable objects (eg > Generators). Adding a warning would alert developers to the issue > > https://wiki.php.net/rfc/counting_non_countables > > Thanks, > Craig I like this. I would personally like to see this behaviour deprecated and removed in 8.0 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.