Re: [RFC] ZPP Failure On Overflow

From: Date: Wed, 24 Sep 2014 21:49:36 +0000
Subject: Re: [RFC] ZPP Failure On Overflow
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-77600@lists.php.net to get a copy of this message
On 24/09/2014 18:40, Stas Malyshev wrote:
That said, most cases of "garbage in, garbage out" would presumably remain so, since most ZPP failures result in a return of NULL or FALSE, which would probably end up cast back to the expected type (int(0), string(''), etc) by the surrounding code.
Right. It’s not an E_RECOVERABLE_ERROR, you’d just get an E_WARNING.
No, you'd get E_WARNING *and* function would not run. Where before it did run. That is the problem, not the warning - you add more cases where the function does not run when it did before, and that can have profound consequences on the code that depends on it.
So, the problem comes with built-in functions, which have some side effect, which can be usefully run with a bogus value for an integer argument. In contrast, any function which has some side effect which is actively harmful given a bogus value would be a beneficiary of the change. A function with no side effects will simply go from "garbage in, garbage out" to "garbage in, NULL out". I wonder how many functions actually fall into each category. -- Rowan Collins [IMSoP]

« previous php.internals (#77600) next »