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]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php