Re: [RFC] Counting of non-countable objects

From: Date: Tue, 04 Oct 2016 17:26:26 +0000
Subject: Re: [RFC] Counting of non-countable objects
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-96235@lists.php.net to get a copy of this message
On 4 October 2016 at 18:10, Nikita Popov <nikita.ppv@gmail.com> wrote: > > A confounding factor is that count() has an alias sizeof() and for people > coming from a C-like background it is quite natural to try to apply > sizeof() to a string in order to get its length. This will silently "work", > but return a meaningless result. > > So, definitely +1 on a warning for all non-array non-Countable cases. > > Ok, but if we're saying that count("string") === 1 is no longer a feature then presumably it makes sense to deprecate in 7.2 and remove in 8.0? Just raising a warning but still providing the feature feels weird to me

« previous php.internals (#96235) next »