#40974 [Opn->Bgs]: whoops

From: Date: Sun, 01 Apr 2007 18:35:47 +0000
Subject: #40974 [Opn->Bgs]: whoops
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110995@lists.php.net to get a copy of this message
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

« previous php.bugs (#110995) next »