From:             justin dot hendrickson+pecl at gmail dot com
Operating system: Ubuntu 6.10
PHP version:      5.2.1
PHP Bug Type:     PDO related
Bug description:  PDO::PARAM_NULL not inserting NULL in MySQL

Description:
------------
Using PDO::PARAM_NULL when doing a bindParam()/bindValue() does not insert
a NULL value. It appears to insert the default value instead. '' in
(var)char/text fields, 0 in boolean fields, ect.

Reproduce code:
---------------
$stmt = 'INSERT INTO table (field) VALUES (:placeholder)';
$stmt->bindValue(':placeholder', PDO::PARAM_NULL);
$stmt->execute();

Expected result:
----------------
`field` in `table` set to NULL

Actual result:
--------------
`field` in `table` set to default value

-- 
Edit bug report at http://bugs.php.net/?id=40974&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40974&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40974&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40974&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40974&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40974&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40974&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40974&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40974&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40974&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40974&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40974&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40974&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40974&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40974&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40974&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40974&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40974&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40974&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40974&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40974&r=mysqlcfg
  • #40974 [NEW]: PDO::PARAM_NULL... justin dot hendrickson+pecl at gmail dot com

Reply via email to