php.net |  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
Votes:4
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jpittman2 at gmail dot com
New email:
PHP Version: OS:

 

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



Reproduce code:
---------------
<?php
$conn = mssql_connect($src, $uid, $pwd);
mssql_select_db($db_name);
$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)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-29 01:04 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: fmk +Assigned To:
 [2016-10-15 23:11 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:11 UTC] kalle@php.net
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-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 05:01:28 2025 UTC