|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45652 Empty string replaced with blank character
Submitted: 2008-07-29 10:43 UTC Modified: 2008-07-29 11:17 UTC
From: dsauneuf at guillemot dot fr Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.2.6 OS: Windows
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:
Solve the problem:
25 - 11 = ?
Subscribe to this entry?

 [2008-07-29 10:43 UTC] dsauneuf at guillemot dot fr
Empty string turned into a blank character.

Running a php site under windows 2003 / IIS / ntwdblib.dll (2000.80.2039.0) to access an SQL server 2000 database. 
Same thing under Windows XP / IIS / ntwdblib.dll.
Works fine under fedora / apache / freetds.


Reproduce code:
$sql=" select '' ";
$res_id=mssql_query($sql)or die ("Database Error");
echo strlen($row[0]);

Expected result:
Should return 0.

Actual result:
Returns 1.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-29 10:50 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

This has been submitted *many* times already, and it is also expected behavior. It\'s simply how MSSQL works.
 [2008-07-29 11:17 UTC] dsauneuf at guillemot dot fr
As I told you it is working fine under fedora / apache / freetds, and this is running with the SAME mssql database.
If you are compting the number of character in an empty string, the result cannot be something different than 0, as it is the definition of the empty string ! So the result is wrong. Now, it can have something to see with either php.ini or the api ntwdblib.dll, or even the way the API is used by PHP, but it cannot be the expected behavior. It is not how MSSQL works either.

If this has been submitted *many* times already, can you please provide me with the resolution brought to those case ?
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 23:01:27 2023 UTC