ID: 40974 User updated by: justin dot hendrickson+pecl at gmail dot com -Summary: PDO::PARAM_NULL not inserting NULL in MySQL Reported By: justin dot hendrickson+pecl at gmail dot com -Status: Open +Status: Bogus Bug Type: PDO related Operating System: Ubuntu 6.10 PHP Version: 5.2.1 New Comment:
PEBKAC Previous Comments: ------------------------------------------------------------------------ [2007-04-01 18:31:47] justin dot hendrickson+pecl at gmail dot com 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 this bug report at http://bugs.php.net/?id=40974&edit=1