php.net |  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
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: skissane at ics dot mq dot edu dot au
New email:
PHP Version: OS:

 

 [2004-01-07 22:17 UTC] skissane at ics dot mq dot edu dot au
Description:
------------
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:
----------------
NULL

Actual result:
--------------
string

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-08 01:07 UTC] fmk@php.net
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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC