Re: Adding TypeError and ValueError to count() function

From: Date: Tue, 21 Jan 2020 19:40:34 +0000
Subject: Re: Adding TypeError and ValueError to count() function
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108207@lists.php.net to get a copy of this message
Hi, On Tue, Jan 21, 2020 at 6:17 PM Nikita Popov <nikita.ppv@gmail.com> wrote: > > In the cases you encountered, do you know what type count() was used on? > Was it null? false? Or something else? > > Nikita we were in a similar boat as Björn to the point where we manually patched PHP in production in order to not emit that warning so we could update PHP while we were migrating the code-base. This made the 7.1 to 7.2 update the most painful update in the history of this application (which was first released when 5.0.0 came out). The most common case was count(null) which unfortunately was happening all the time because of functions deciding to return an array with elements or null if there was no elements to be found. Yes, that's bad form, but hey - this is a nearly 20 years old application. Of all the changes I've seen happening in PHP, this was the most painful. Philip

« previous php.internals (#108207) next »