Re: [RFC] 64 bit platform improvements for string length and integer

From: Date: Sat, 11 Jan 2014 15:29:43 +0000
Subject: Re: [RFC] 64 bit platform improvements for string length and integer
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sat, January 11, 2014 16:05, Jakub Zelenka wrote:
> On Sat, Jan 11, 2014 at 2:48 PM, Anatol Belski <[email protected]> wrote:
>
>
>> the range checks is what 'L' vs 'I' would stand for, the 'L'
>> would be
>> available as alias for 'I', so one don't has to change zpp. A good
>> thing were to add type checks,
>>
>>
> Oh I see. The only small objection is that these lines could lead to the
> unexpected result from the user point of view:
>
> if (d > ZEND_INT_MAX) { *p = ZEND_INT_MAX;
> break; } else if (d < ZEND_INT_MIN) {
> *p = ZEND_INT_MIN;
> break; }
>
>
> I think that would make sense to add warning here
>
>
> Also similar checks for "s" and "p" length part (size_t -> int) would be
> great too! ;)
>
yep, that's exactly how it performs till now in the mainstream, just
replace ZEND_INT_MAX with LONG_MAX. Adding a warning to every such case
would cause a warning flood in many PHP apps, guaranteed :) Whereby it
might be ok for debug mode maybe, I wouldn't do it as I can't remember any
WTFs about the behavior.

Cheers

Anatol


Thread (80 messages)

« previous php.internals (#71064) next »