From:             [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version:      4.2.3
PHP Bug Type:     Math related
Bug description:  hexdec() returns floats when supplied string begins with '0'

hexdec('012345') should return int(74565), but instead it returns
float(74565), contrary to the documentation. This happens for all numbers
in strings I've tested that begin with 0, which does not include
non-hexadecimal characters which are taken to be 0, eg, hexdec('q12345')
returns int.

(Fixing the problem by casting the result to an (int) works fine. It
originally catched me out when I used array_flip on an array of results,
which demands integer or string keys.)

I'm not sure what the configure line is, but it's just a regular install
from the downloaded executable binary, with no extra modules loaded. Since
maths functions are in the PHP core, it hopefully won't matter.

Thanks
Andrew Alderwick, United Kingdom
-- 
Edit bug report at http://bugs.php.net/?id=19733&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=19733&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=19733&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=19733&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=19733&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=19733&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=19733&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=19733&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=19733&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=19733&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=19733&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=19733&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=19733&r=dst

Reply via email to