php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
8 + 43 = ?
Subscribe to this entry?

 
 [2008-07-16 09:21 UTC] technischersupport at googlemail dot de
Description:
------------
It's the same bug as in:

http://bugs.php.net/bug.php?id=26012
http://bugs.php.net/bug.php?id=26315
http://bugs.php.net/bug.php?id=28124
http://bugs.php.net/bug.php?id=31641
http://bugs.php.net/bug.php?id=36968
http://bugs.php.net/bug.php?id=39204

described.

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

with php_mssql.dll
Version 5.2.6.6

ntwdblib.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);

$qry = "SELECT * FROM TABLE";
$result_id = mssql_query($qry, $connection);
$row = mssql_fetch_assoc($result_id)
print_r($row);

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

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-17 01:07 UTC] jani@php.net
[4 Apr 2006 7:03pm UTC] fmk@php.net [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:

http://msdn.microsoft.com/en-us/library/ms143729.aspx

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-2022 The PHP Group
All rights reserved.
Last updated: Sun Dec 04 07:05:53 2022 UTC