From:             
Operating system: All
PHP version:      5.3SVN-2010-09-20 (SVN)
Package:          MySQLi related
Bug Type:         Bug
Bug description:Wrong data inserted with mysqli/mysqlnd when using 
bind_param,value>LONG_MAX

Description:
------------
LONG_MAX is differs from platform to platform. 

Because zval internally uses a signed long for integer fields when the
value in the script is over LONG_MAX, or under -LONG_MAX-1 then the value
is fit into a double. When using mysqli_stmt_bind_param with such a value
and "i" modifier then the value is converted back to long, which results in
incorrect results - like if the VALUE was LONG_MAX+1 the result will be -1
(internally it is a signed long).

Test script:
---------------
CREATE TABLE tint(a bigint unsigned);





./php -r
'$c=mysqli_connect("127.0.0.1","root","root","test");$s=$c->prepare("insert
into tint
values(?)");$param=4294967295;$s->bind_param("i",$param);var_dump($s->execute());'

bool(true)

Expected result:
----------------
Don't bork the data. Check if the value can't be fit into a long, and if
this is the case use string to send to the server (changing the modifier to
"s" just for the next execution, preserve "i" for further executions).

Actual result:
--------------
-1

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52891&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52891&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52891&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52891&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52891&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52891&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52891&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52891&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52891&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52891&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52891&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52891&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52891&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52891&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52891&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52891&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52891&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52891&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52891&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52891&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52891&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52891&r=mysqlcfg

Reply via email to