|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45527 whitespaces in resultset of empty varchars/text
Submitted: 2008-07-16 09:21 UTC Modified: 2008-07-17 08:13 UTC
From: technischersupport at googlemail dot de Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.6 OS: Windows XP
Private report: No CVE-ID: None
 [2008-07-16 09:21 UTC] technischersupport at googlemail dot de
It's the same bug as in:


I'm using MSSQL 2005:
Microsoft SQL Server Standard Edition
Microsoft Windows NT 5.2 (3790)

with php_mssql.dll

Version 2000.02.08 (as supplied with php)

The Table:

	[COLA] [varchar](5) NULL
	[COLB] [varchar](25) NULL
	[COLC] [varchar](5) NULL
	[COLD] [varchar](25) NULL
	[COLE] [varchar](40) NULL
	[COLF] [text] NULL

I've written empty strings to the cells and read it out with the appended code.

The bug isn't bogus!

Reproduce code:
$connection = mssql_connect($server, $username, $password, true);

$result_id = mssql_query($qry, $connection);
$row = mssql_fetch_assoc($result_id)

Expected result:
[COLA] => "foo"
[COLB] => "bar"
[COLC] => ""
[COLD] => ""
[COLE] => ""
[COLF] => ""

Actual result:
[COLA] => "foo"
[COLB] => "bar"
[COLC] => " "
[COLD] => " "
[COLE] => " "
[COLF] => " "


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-17 01:07 UTC]
[4 Apr 2006 7:03pm UTC] [delete]

This is a bug in the DB library used in the extension. The only
workarround is to trim the value and that would be wrong if the data
storred actually was a space.

 [2008-07-17 08:13 UTC] technischersupport at googlemail dot de
I asked a sysadmin about that bug and he sent me the following URL:

In the middle of the page (Features Not Supported in a Future Version of SQL Server -> Other):

"Although the SQL Server 2005 Database Engine still supports connections from existing applications using the DB-Library and Embedded SQL APIs, it does not include the files or documentation needed to do programming work on applications that use these APIs. A future version of the SQL Server Database Engine will drop support for connections from DB-Library or Embedded SQL applications. Do not use DB-Library or Embedded SQL to develop new applications. Remove any dependencies on either DB-Library or Embedded SQL when modifying existing applications. Instead of these APIs, use the SQLClient namespace or an API such as OLE DB or ODBC. SQL Server 2005 does not include the DB-Library DLL required to run these applications. To run DB-Library or Embedded SQL applications you must have available the DB-Library DLL from SQL Server version 6.5, SQL Server 7.0, or SQL Server 2000."

So why is php using that discontinued code like that?
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Feb 26 09:01:26 2024 UTC