From:             christian at activemediaworks dot com
Operating system: MAC OSX 10.5.8
PHP version:      5.2.12
PHP Bug Type:     PDO related
Bug description:  PDO MYSQL issue with BIT data type not setting correct value

Description:
------------
When trying to insert a row with a 0-value into a column of type BIT(1),
if the value for the column is not hard-coded into SQL statement, it causes
the value to be inserted to become 1. If it is hardcoded, it is okay.

Reproduce code:
---------------
/* This results in the value of the column being set to 1 (incorrect) */
$db = new PDO ( "mysql:dbname=db1234;host=localhost", "user1234",
"pass1234" );
$stmt = $db->prepare("INSERT INTO mytable (mybit) VALUES (?)");
$stmt->execute(array(0));
db_disconnect($db);

/* This results in the value of the column being set to 0 (correct) */
$db = new PDO ( "mysql:dbname=db1234;host=localhost", "user1234",
"pass1234" );
$stmt = $db->prepare("INSERT INTO mytable (mybit) VALUES (0)");
$stmt->execute();
db_disconnect($db);


Actual result:
--------------
The first example inserts a row with the column value set to 1 (wrong)

The second example inserts a row with the column value set to 0 (right)

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

Reply via email to