|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26835 wrong data type returned by mssql_fetch_array
Submitted: 2004-01-07 22:17 UTC Modified: 2004-01-08 22:24 UTC
From: skissane at ics dot mq dot edu dot au Assigned:
Status: Closed Package: MSSQL related
PHP Version: 4.3.4 OS: Solaris 2.6
Private report: No CVE-ID: None
 [2004-01-07 22:17 UTC] skissane at ics dot mq dot edu dot au
The following script returns an empty string on Solaris, when it should return a NULL (which it does, correctly, on Linux.)

This is using FreeTDS 0.61.2 (same problem occurs with FreeTDS 0.52).

This is talking to a SQL Server 2000 using TDS version 7.0 (switching to 8.0 made no difference).

I've checked, and:
mssql.compatability_mode = Off
in php.ini.

Reproduce code:
$id = mssql_connect("<servername>","<username>","<password>");
$q = mssql_query("SELECT NULL",$id);
$f = mssql_fetch_array($q);
echo gettype($f[0]);

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-08 01:07 UTC]
This seams to be a problem on Solaris or FreeTDS. I've tested the code on Linux and Win32 and can't reproduce the problem.

The code is designed to return NULL if the db-api returns zero length data. For some reson NULL bust be translated into a non zero length value on Solaris.
 [2004-01-08 22:24 UTC] skissane at ics dot mq dot edu dot au
Upon closer investigation, the problem was not with Solaris at all, it was that the Solaris box was using the mssql_* functions with PHP configured with --with-sybase=<path to freetds>, and the Linux box was using the mssql_* functions with --with-mssql=<path to freetds>. Recompiling PHP on the Solaris box using --with-mssql solved the problem. This probably relates to the bugs with the sybase extension which have been reported in other bug reports.

Sorry about wasting your time. (I would mark this bug as Bogus, not Closed, but it won't let me do that.)
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat May 28 17:05:46 2022 UTC