Re: PHP Bug id #4254, addendum
| From: | Stanislav Malyshev | Date: | Mon, 21 Aug 2000 14:30:02 +0000 |
| Subject: | Re: PHP Bug id #4254, addendum | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-30059@lists.php.net to get a copy of this message | ||
>> They are all related to using the function strtol(),
>> which only returns a sane value for a number within
>> *signed* range.
Yes, this is true. PHP arithmetics is reliable only in signed long range,
then you should move to bcmath extension. Since it is impossible to make
it work reliable with numbers that don't fit in signed long anyway, I'm
not sure it worth trying.
>>
>> In zend-scanner.l (version 4.01pl2) there's this code section:
>> -------------------------
[skip]
>> -------------------------
>> which switches to double as soon as the input range is exceeded.
>> It should be better to also try getting a sane value, after
>> strtol() failed, with the strtoul() function.
Well, this doesn't have too much sense, since most functions do suppose
it's a signed long. So you are up to surprises in any case.
>> Something else: Right now, hex numbers printed out through printf()
>> are treated as signed. Is it possible to switch to unsigned numbers,
>> to be more inline with the standard C implementation of %x parsing?
Doesn't PHP printf has "u" flag? Anyway, general rule of thumb is that
integers in PHP are signed longs. It is not good to insert kludges here
and there to fix some particular cases, since you cannot fix 100% of it
anyway, so better use the working solution.
>> BTW, is there a web based CVS repository for the Zend engine?
Not that I know of.
>> ps. Is there a more proper way to submit an addendum for a third party bug
>> than a direct email?
php-dev@lists.php.net
--
Stanislav Malyshev stas@zend.com
+972-3-6139665 ext.106