#42474 [NEW]: mssql_fetch_* returns 0 instead of NULL when a bit field is NULL
| From: | jpittman2 at gmail dot com | Date: | Wed, 29 Aug 2007 17:47:59 +0000 |
| Subject: | #42474 [NEW]: mssql_fetch_* returns 0 instead of NULL when a bit field is NULL | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-116830@lists.php.net to get a copy of this message | ||
From: jpittman2 at gmail dot com
Operating system: Windows 2003 (5.2)
PHP version: 5.2.3
PHP Bug Type: MSSQL related
Bug description: mssql_fetch_* returns 0 instead of NULL when a bit field is NULL
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)
--
Edit bug report at http://bugs.php.net/?id=42474&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42474&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42474&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42474&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42474&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42474&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42474&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42474&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42474&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42474&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42474&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42474&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42474&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42474&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42474&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42474&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42474&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42474&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42474&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42474&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42474&r=mysqlcfg