|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #73852 Deprecate and remove PDO::PARAM_NULL
Submitted: 2017-01-02 18:04 UTC Modified: 2017-10-24 08:31 UTC
From: dorin dot marcoci at gmail dot com Assigned:
Status: Open Package: PDO related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-01-02 18:04 UTC] dorin dot marcoci at gmail dot com
NULL is a state, not a type or a value.
Using it as argument in bindValue or bindParam is a non-sense.
Nulls should be set like $stmt->bindValue('param', NULL, PDO::PARAM_INT);


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-06 18:34 UTC]
-Type: Bug +Type: Feature/Change Request
 [2017-01-06 18:34 UTC]
> Nulls should be set like $stmt->bindValue('param', NULL,

As PHP is a loosely typed language, I would expect that to bind 0
(zero) to :param. Anyhow, having PDO::PARAM_NULL is not a bug per
se, and deprecating and removing it would almost certainly require
an RFC, see <>.
 [2017-01-06 18:43 UTC] dorin dot marcoci at gmail dot com

Please, see more on this subject here:

I agree it require an RFC. But current implementation of PDO::PARAM_NULL as a type is really a bad approach. 

What to put in param this case? 

bindValue('param', 'string', PDO::PARAM_NULL);

bindValue('param', 0, PDO::PARAM_NULL); // if 0 can be casted as null, why not 1?


bindValue('param', TRUE, PDO::PARAM_NULL); // Put a NULL here?
 [2017-10-24 08:31 UTC]
-Package: PDO Core +Package: PDO related
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Jun 19 16:01:23 2021 UTC