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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Thu Nov 26 02:01:23 2020 UTC