ID: 49107
Comment by: jochem dot blok at fasterforward dot nl
Reported By: jochem dot blok at fasterforward dot nl
Status: Open
Bug Type: MSSQL related
Operating System: Debian
PHP Version: 5.2.10
New Comment:
Additional info:
FreeTDS (tds version 8.0), Sql Server 2005 SP3
Previous Comments:
------------------------------------------------------------------------
[2009-07-30 07:53:37] jochem dot blok at fasterforward dot nl
Description:
------------
This is the same bug as reported in bug: 39213. An empty string is
returned as NULL.
Reproduce code:
---------------
$conn = mssql_connect('host','user','password', true);
mssql_query("CREATE TABLE #tmp(c VARCHAR(10) NULL)", $conn) or
die("error querying");
mssql_query("INSERT INTO #tmp VALUES('')", $conn) or die("error
querying");
$res = mssql_query("SELECT * FROM #tmp", $conn) or die("query");
$row = mssql_fetch_assoc($res);
$s = is_null($row['c']) ? 'NULL' : $row['c'];
echo "got -$s-\n";
Expected result:
----------------
var_dump($s) should print string(0) ""
Actual result:
--------------
var_dump($s) print NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49107&edit=1