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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Tue Nov 24 07:01:24 2020 UTC