ID:               47092
 Comment by:       erik at ekriirke dot com
 Reported By:      erik at ekriirke dot com
 Status:           Feedback
 Bug Type:         Scripting Engine problem
 Operating System: *
 PHP Version:      5.2.8
 New Comment:

Ah, you are right about the 32/64 bit, however you are wrong about
there being no bug.
Had you read the thread you would see that only in certain instances it
fails to work correctly.  Immediates work perfectly on both
architectures, its the passing of such values from mysql(i) functions
that fails.

Also discovered is the conversion from string>integer fails.


Previous Comments:
------------------------------------------------------------------------

[2009-10-08 14:52:20] j...@php.net

Wild guess: that linux machine is 64bit whereas windows is 32bit.
In which case there is no bug.

------------------------------------------------------------------------

[2009-08-26 17:04:47] erik at ekriirke dot com

Interesting.  So it's PHP itself, and MySQL passes numbers as strings
internally?
dechex was just used to make the bits easily readable, though that's
not the real issue - try performing bitwise operations in the instances
dechex shows all bits high, the result will be wrong:

php -r '$a="2147488308";print_r($a);echo "\n";print_r($a+1);echo
"\n";print_r($a&0xFFFF);echo "\n";print_r(dechex($a&0xFFFF));echo
"\n";print_r(($a+0)&0xFFFF);echo
"\n";print_r(dechex(($a+0)&0xFFFF));echo "\n";'
2147488308
2147488309
65535
ffff
4660
1234

What version are you using, Andre?  Just tested it on Fedora12:
[e...@erik ~]$ php --version
PHP 5.2.9 (cli) (built: Apr 15 2009 09:30:24)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

...and it appears to work!
However, this newer(!) version (windows vista) still shows the error:

C:\>php --version
PHP 5.2.10 (cli) (built: Jun 17 2009 16:16:57)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

------------------------------------------------------------------------

[2009-08-26 12:45:19] and...@php.net

This is not a problem in MySQL, it is a PHP bug or dechex bug.

Here is an example. First, we use a number, than a string with a
number. 

and...@winnie:~/scripts$ php -r '$a=2147488308;print_r($a);echo
"\n";print_r($a+1);echo "\n";print_r(dechex($a));echo "\n";'
2147488308
2147488309
80001234


and...@winnie:~/scripts$ php -r '$a="2147488308";print_r($a);echo
"\n";print_r($a+1);echo "\n";print_r(dechex($a));echo "\n";'
2147488308
2147488309
7fffffff


------------------------------------------------------------------------

[2009-01-13 22:22:13] erik at ekriirke dot com

I meant to say "32bit math" is touchy, sorry

------------------------------------------------------------------------

[2009-01-13 22:02:35] erik at ekriirke dot com

Just an addendum;  This is only when working with MySQL (from what I
have tested), absolutes do not have this problem (eg  echo
dechex(0x80001234);)

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/47092

-- 
Edit this bug report at http://bugs.php.net/?id=47092&edit=1

Reply via email to