Re: [RFC] ZPP Failure On Overflow
| From: | Andrea Faulds | Date: | Thu, 25 Sep 2014 02:00:18 +0000 |
| Subject: | Re: [RFC] ZPP Failure On Overflow | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77602@lists.php.net to get a copy of this message | ||
> On 25 Sep 2014, at 02:17, Stas Malyshev <smalyshev@sugarcrm.com> wrote:
>
> 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.
No it won't. Normally it truncates (module), only some functions cap.
--
Andrea Faulds
http://ajf.me/