php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40974 whoops
Submitted: 2007-04-01 18:31 UTC Modified: 2007-04-01 18:35 UTC
From: justin dot hendrickson+pecl at gmail dot com Assigned:
Status: Not a bug Package: PDO related
PHP Version: 5.2.1 OS: Ubuntu 6.10
Private report: No CVE-ID: None
 [2007-04-01 18:31 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-01 18:35 UTC] justin dot hendrickson+pecl at gmail dot com
PEBKAC
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Feb 25 18:01:23 2021 UTC