|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42474 mssql_fetch_* returns 0 instead of NULL when a bit field is NULL
Submitted: 2007-08-29 17:47 UTC Modified: 2016-10-15 23:11 UTC
Avg. Score:4.0 ± 0.7
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (25.0%)
From: jpittman2 at gmail dot com Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2.3 OS: Windows 2003 (5.2)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: jpittman2 at gmail dot com
New email:
PHP Version: OS:


 [2007-08-29 17:47 UTC] jpittman2 at gmail dot com
mssql_fetch_* returns 0 instead of NULL when the datatype is "bit".

Reproduce code:
$conn = mssql_connect($src, $uid, $pwd);
$sql = "SELECT Cast (Null as Bit) As Should_Be_Null,"
     . "       Cast (0 as Bit)    AS Should_Be_Int_0,"
     . "       Cast (1 as Bit)    As Should_Be_Int_1";
$result = mssql_query($sql);
return mssql_fetch_array($result);

Expected result:
Should return (NULL, 0, 1)

Actual result:
returns (0, 0, 1)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-29 01:04 UTC]
-Status: Assigned +Status: Open -Assigned To: fmk +Assigned To:
 [2016-10-15 23:11 UTC]
-Status: Open +Status: Wont fix
 [2016-10-15 23:11 UTC]
With MSSQL being removed from PHP as of PHP7.0, and ext/mssql not having a maintainer, I'm gonna close this report as a Won't fix, until maybe one day it will find a new maintainer.

Alternatively you can use sqlsrv from Microsoft if you are on Windows, or pdo_dblib if you are on Unix.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 07:01:24 2020 UTC