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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
29 - 18 = ?
Subscribe to this entry?

 
 [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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC