php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49107 Empty string is returned as NULL
Submitted: 2009-07-30 07:53 UTC Modified: 2016-10-15 23:13 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jochem dot blok at fasterforward dot nl Assigned:
Status: Wont fix Package: MSSQL related
PHP Version: 5.2.10 OS: Debian
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: jochem dot blok at fasterforward dot nl
New email:
PHP Version: OS:

 

 [2009-07-30 07:53 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-30 07:56 UTC] jochem dot blok at fasterforward dot nl
Additional info:

FreeTDS (tds version 8.0), Sql Server 2005 SP3
 [2016-10-15 23:13 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-10-15 23:13 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