Re: [RFC] ZPP Failure On Overflow
| From: | Stas Malyshev | Date: | Thu, 25 Sep 2014 01:17:10 +0000 |
| Subject: | Re: [RFC] ZPP Failure On Overflow | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77601@lists.php.net to get a copy of this message | ||
Hi!
> 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.
No bogus value ever gets to a function - it always gets INT_MAX on
overflow. If INT_MAX is harmful for this function, this change does not
help as you could still pass INT_MAX and this change would not do anything.
The thing is relying on this would not really improve your code - it is
very rare that INT_MAX+1 is harmful for your function but INT_MAX-1 is
not. But it may be useful to know that you can pass any value and it
will be capped at INT_MAX.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/